uinavigationbar

Make a custom back button for UINavigationController

白昼怎懂夜的黑 提交于 2019-11-27 19:01:10
问题 I'm developping an app for iOS 4.2+. I subclassed my UINavigationController to insert two UIImageView and make the navigation bar look custom. Everything is working great but I have a little problem. I created custom UIBarButtonItem and inside my view controllers i put them with : self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton]; It works too but the problem is that to make this work I need to call it from: - (void)viewDidAppear:(BOOL)animated ;

How do you add more than one UIBarButton on UINavigationItem.rightBarButtonItem (or leftBarButtonItem)?

為{幸葍}努か 提交于 2019-11-27 18:24:50
I have tried this approach/hack: http://blog.blackwhale.at/2009/06/uibuttons-in-uinavigationbar/ The problem is this leaves a faint seam. I tried setting the background image of the nested toolbar to an image I captured of what it should be. That didn't work. The image was not applied. I have also tried using a nested UINavigationBar and that didn't seem to work. I have seen this done in several iPhone apps. Does anyone know how? [EDIT] I want the buttons to look like normal UIBarButtonItems and be able to use system styles like UIBarButtonSystemItemAdd, UIBarButtonSystemItemRefresh. The link

Checking if a UIViewController is about to get Popped from a navigation stack?

橙三吉。 提交于 2019-11-27 18:16:51
I need to know when my view controller is about to get popped from a nav stack so I can perform an action. I can't use -viewWillDisappear, because that gets called when the view controller is moved off screen for ANY reason (like a new view controller being pushed on top). I specifically need to know when the controller is about to be popped itself. Any ideas would be awesome, thanks in advance. I don't think there is an explicit message for this, but you could subclass the UINavigationController and override - popViewControllerAnimated (although I haven't tried this before myself).

iOS 11 UISearchBar in UINavigationBar

試著忘記壹切 提交于 2019-11-27 18:12:02
I want to place a search bar in the new navigation bar with the new iOS 11 large titles. However, the color of the search bar is automatically applied by iOS and I can't change it. if #available(iOS 11.0, *) { let sc = UISearchController(searchResultsController: nil) navigationItem.searchController = sc navigationItem.hidesSearchBarWhenScrolling = false } The search bar get's a deep blue background, but I just want to change it to white. Setting the background color results in this: navigationItem.searchController?.searchBar.backgroundColor = UIColor.white I have tried also

How can we put two line in UIBarButtonItem in Navigation Bar

。_饼干妹妹 提交于 2019-11-27 18:09:10
问题 "Now Playing" is in One line in UIBarButtonItem. I have to put it in two lines, like "Now" is ay top and "Playing" is at bottom.I have written the following line of code:- UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle:@"Now Playing" style:UIBarButtonItemStyleBordered target:self action:@selector(flipView)]; self.navigationItem.rightBarButtonItem = flipButton; So i want to pu line break in between "Now Playing". So please help me out. 回答1: Yes you can. It is fairly

Change font of back navigation bar button

你离开我真会死。 提交于 2019-11-27 18:06:44
I want to be able to set the font of my apps navigation bar back button without doing anything too crazy and without losing any other design characteristics of the button (i.e. I want to keep the arrow). Right now I use this in viewDidAppear: to set the font of the normal bar button items. for (NSObject *view in self.navigationController.navigationBar.subviews) { if ([view isKindOfClass:[UIButton class]]) { [((UIButton*)view).titleLabel setFont:[UIFont fontWithName:@"Gill Sans" size:14.0]]; } } However this makes no change on the back button, regardless of which UIViewController this code is

iOS Custom Status Bar Background Color not displaying

最后都变了- 提交于 2019-11-27 17:34:10
问题 I am trying to fill the status bar background color to orange using the following UINavigationBar.appearance().tintColor = UIColor.orangeColor() UINavigationBar.appearance().barTintColor = UIColor.orangeColor() UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()] UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true) However, I get a white status bar that should be filled with orange instead from

Add button to navigationbar programmatically

ぐ巨炮叔叔 提交于 2019-11-27 17:28:58
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] initWithFrame:CGRectMake(0, 0, 130, 44.01)]; [container addSubview:button]; [button release]; // add another

How to set font & color of the title in UINavigationBar using iOS5 appearance API?

﹥>﹥吖頭↗ 提交于 2019-11-27 17:25:31
I have a multiple View Controllers and I want to set the font color of all to red. [[UINavigationBar appearance] setFont:[UIFont boldSystemFontOfSize:12.0]]; is throwing an unrecognized selector error. How can I fix this? TigerCoding From Ray Wenderlich: http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5 // Customize the title text for *all* UINavigationBars [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0], UITextAttributeTextColor, [UIColor

Add segmented control to navigation bar and keep title with buttons

China☆狼群 提交于 2019-11-27 17:18:36
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. 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 knowledgeable enough to tell for sure...) Anyway I simply used a toolbar placed just underneath the navigation bar