uinavigationbar

How to prevent UINavigationBar from covering top of view in iOS 7?

亡梦爱人 提交于 2019-11-26 12:20:43
问题 After updating to Xcode 5, the navigation bars in all of my app\'s views have shifted down. Here are some screenshots, the first showing everything in the view as it\'s pulled down, and the second showing all of it untouched. The search bar should begin where the navigation bar. Anyone know how I can fix this? edit: i have tried this previously recommendation: if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) self.edgesForExtendedLayout = UIRectEdgeNone; But it yields very odd

UINavigationBar custom back button without title

和自甴很熟 提交于 2019-11-26 11:57:23
How can I customize the navigation back button in iOS 7 and above without title? (i.e. with the arrow only) self.navigationItem.leftBarButtonItem = self.editButtonItem; I'm just wondering if they have any self.backButtonItem; OR something like this? self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBACK target:self action:@selector(back)]; Kyle Begeman It's actually pretty easy, here is what I do: Objective C // Set this in every view controller so that the back button displays back instead of the root view controller name self

iPhone: Setting Navigation Bar Title

﹥>﹥吖頭↗ 提交于 2019-11-26 11:55:02
问题 Hey all. I\'m still pretty new to iPhone development, and I\'m having a bit of trouble figuring out how to change the title of my Navigation Bar. On another question on this site somebody recommended using : viewController.title = @\"title text\"; but that isn\'t working for me...Do I need to add a UINavigationController to accomplish this? Or maybe just an outlet from my UIViewController subclass? If it helps, I defined the navigation bar in IB and I\'m trying to set its title in my

Make UINavigationBar transparent

夙愿已清 提交于 2019-11-26 11:02:05
How do you make a UINavigationBar transparent ? Though I want its bar items to remain visible. Gabriele Petronella If anybody is wondering how to achieve this in iOS 7+, here's a solution (iOS 6 compatible too) In Objective-C [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationBar.shadowImage = [UIImage new]; self.navigationBar.translucent = YES; In swift 3 (iOS 10) self.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationBar.shadowImage = UIImage() self.navigationBar.isTranslucent = true In swift 2 self.navigationBar

Hiding UITabBar when pushing a UIView

走远了吗. 提交于 2019-11-26 10:28:16
问题 I have a UITabBarController where the default view controller is a UINavigationController . I want to be able to hide the UITabBar of the UITabBarController when I push a certain view in the UINavigationController . I\'ve tried adding: delegate.tabBarController.hidesBottomBarWhenPushed = YES; in my UINavigationController before I push the view, but that doesn\'t seem to do the trick. Any tips on what I should be doing or if it\'s even possible? Thanks in advance! 回答1: This is better:

Trying to handle “back” navigation button action in iOS

≯℡__Kan透↙ 提交于 2019-11-26 10:24:54
I need to detect when the user taps the "back" button on the navigation bar, in order to perform some operations when that occurs. I'm trying to set manually an action to such button, this way: [self.navigationItem.backBarButtonItem setAction:@selector(performBackNavigation:)]; - (void)performBackNavigation:(id)sender { // Do operations [self.navigationController popViewControllerAnimated:NO]; } I firstly placed that code in the view controller itself, but I found that self.navigationItem.backBarButtonItem seemed to be nil , so I moved that same code to the parent view controller, which pushes

How to subclass UINavigationBar for a UINavigationController programmatically?

陌路散爱 提交于 2019-11-26 10:23:22
问题 I\'m using a custom drawRect function to draw on UINavigationBar across my application in iOS4, it doesn\'t use images, only CoreGraphics. Since you can\'t implement drawRect in UINavigationBar category in iOS5, Apple is suggesting to subclass UINavigationBar . How is it possible to replace the UINavigationBar with my subclass in UINavigationController (so it\'ll be compatible with iOS4 and iOS5) when the navigationBar property is read only? @property(nonatomic, readonly) UINavigationBar

iOS 11 customise search bar in navigation bar

北战南征 提交于 2019-11-26 10:09:35
问题 I want to change the color of the text and icon in the iOS 11 searchbar when it is embedded in the navigation bar. So placeholder text, search text and search icon. if #available(iOS 11.0, *) { navigationController?.navigationBar.prefersLargeTitles = false let searchController = UISearchController(searchResultsController: nil) navigationItem.searchController = searchController navigationItem.hidesSearchBarWhenScrolling = false searchController.searchBar.placeholder = \"Suchen\"

Changing navigation title programmatically

我只是一个虾纸丫 提交于 2019-11-26 10:08:33
问题 I have a navigation bar with a title. When I double click the text to rename it, it actually says it\'s a navigation item, so it might be that. I\'m trying to change the text using code, like: declare navigation bar as navagationbar here button stuff { navigationbar.text = \"title\" } That\'s not my code obviously, just showing how it would work. So whenever I press the button, I want the title to change. 回答1: You change the title by changing the title of the view controller being displayed:

How to make completely transparent navigation bar in iOS 7

試著忘記壹切 提交于 2019-11-26 10:06:36
问题 I want the UINavigationBar in my app to be completely transparent and flush with the viewcontroller directly under it. However, the only code I could find makes it translucent but not transparent. I know this can be done in iOS 7 because it is used in the notes app. My question is, what is the code they used to do it? 回答1: From this answer [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationController.navigationBar