uinavigationbar

How to draw a transparent UIToolbar or UINavigationBar in iOS7

假装没事ソ 提交于 2019-11-26 19:15:49
I would like an entirely transparent UIToolbar and/or UINavigationBar . I have tried the various incantations suggested for pre- and post-iOS 5 but none seem to work any more. How might this be accomplished in iOS 7? Gabriele Petronella Swift 3 (iOS 10) Transparent UIToolbar self.toolbar.setBackgroundImage(UIImage(), forToolbarPosition: .any, barMetrics: .default) self.toolbar.setShadowImage(UIImage(), forToolbarPosition: .any) Transparent UINavigationBar self.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationBar.shadowImage = UIImage() self.navigationBar.isTranslucent

Add button to navigationbar programmatically

会有一股神秘感。 提交于 2019-11-26 19:00:46
问题 Hi I need to set the button on right side, in navigation bar, programatically , so that if I press the button I will perform some actions. I have created the navigation bar, programatically by; navBar=[[UINavigationBar alloc]initWithFrame:CGRectMake(0,0,320,44) ]; Similarly, I need to add the button, on the right side of this navigation bar. For that I used, 1. UIView* container = [[UIView alloc] init]; // create a button and add it to the container UIButton* button = [[UIButton alloc]

Add segmented control to navigation bar and keep title with buttons

北城余情 提交于 2019-11-26 18:58:35
问题 I want to add segmented control to the navigation bar but also keep the title and buttons, like in iOS 7 Appstore purchased section (example) I have tried adding segmented control as title view and then using prompt as the title, but then the buttons are on the same level as segmented control. 回答1: I have tried solving your problem using another approach since using a navigation bar only didn't seem to work out (maybe it's because the AppStore app is using a private api but I'm not

Remove border in navigationBar in swift

丶灬走出姿态 提交于 2019-11-26 18:47:35
问题 i've been trying to remove the navigationBars border without luck. I've researched and people seem to tell to set shadowImage and BackgroundImage to nil, but this does not work in my case. My code self.navigationController?.navigationBar.barTintColor = UIColor(rgba: "#4a5866") self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: ""), forBarMetrics: UIBarMetrics.Default) self.navigationController?.navigationBar.shadowImage = UIImage(named: "") illustration: 回答1: The

UILabel text truncation vs. line breaks in text

♀尐吖头ヾ 提交于 2019-11-26 18:38:47
问题 I have a UILabel that is put as titleView in the navigation bar. I want it to have 2 lines, where the first line can be truncated and the second is center aligned. In code it looks more less like this: let label = UILabel() let text = NSAttributedString(string: "Long long long text\nsecond line") label.attributedText = text label.textAlignment = .Center label.numberOfLines = 0 label.lineBreakMode = .ByTruncatingTail label.sizeToFit() self.navigationItem.titleView = label The effect in case of

Adding back button to navigation bar

岁酱吖の 提交于 2019-11-26 18:22:45
问题 I've added a navigation bar to a UIViewController. It is displayed from another UIViewController only. I'd like to have a left side back button that is shaped similar to an arrow, just like the normal navigation bar back button. It seems I can only add a bar button through IB. I'm guessing the back button needs to be added programmatically. Any suggestions on how I should do this? Currently, in the RootController, I push another UIViewController (viewB) by simply doing an addSubView. In viewB

Removing the title text of an iOS UIBarButtonItem

ε祈祈猫儿з 提交于 2019-11-26 18:04:52
What I wanted to do is to remove the text from the 'Back' button of a UIBarButtonItem , leaving only the blue chevron on the navigation bar. Keep in mind that I'm developing for iOS 7. I've tried several methods, including, but not limited to: This is the image method which I did not like (the image looked out of place): UIBarButtonItem *barBtnItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iOS7BackButton"] style:UIBarButtonItemStylePlain target:self action:@selector(goToPrevious:)]; self.navigationItem.leftBarButtonItem = barBtnItem; Another method I tried was this, which

How to prevent status bar from overlapping content with hidesBarsOnSwipe set on UINavigationController?

半世苍凉 提交于 2019-11-26 17:59:38
问题 I'm trying to use the new feature added in iOS 8 - hiding the navigation bar while user is scrolling the table view (similar to what mobile Safari does). I'm setting the property hidesBarsOnSwipe of UINavigationController to YES in viewDidAppear method of UITableViewController : - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if([self.navigationController respondsToSelector:@selector(hidesBarsOnSwipe)]) { self.navigationController.hidesBarsOnSwipe = YES; } } The

Achieving bright, vivid colors for an iOS 7 translucent UINavigationBar

怎甘沉沦 提交于 2019-11-26 17:59:34
iOS 7.1 UPDATE : Looks like the workaround for modifying the alpha channel in the UINavigationBar has been ignored in this update. Right now, the best solution seems to be to just 'deal with it' and hope that whatever color you choose can render a translucent effect. I am still looking into ways of getting around this. iOS 7.0.3 UPDATE : The GitHub library we created has been updated to slightly work around this issue when using iOS 7.0.3. Unfortunately, there is no magic formula to support both colors created in iOS 7.0.2 and earlier and iOS 7.0.3. Seems like Apple improved the saturation,

Is there a way to change the height of a UINavigationBar in Storyboard without using a UINavigationController?

馋奶兔 提交于 2019-11-26 17:57:49
问题 I want to use a custom UINavigationBar in one of my views, which is not a part of any UINavigationController -hierarchy. When I drag a UINavigationBar into Storyboard, it shows like this: This bar is 44px, which would be enough if the status bar wouldn't share this space. Because iOS7 lets us use the entire screen, including the space for the status bar, the UINavigationBar should be 64px tall, not 44px. If I connect the view to a UINavigationController 's hierarchy, then it shows correct: I