uinavigationbar

Auto Layout with UINavigationBar and UIBarButtonItem

好久不见. 提交于 2019-12-10 03:39:33
问题 I like to create my views as standalone Xib files then instantiate them and add as subviews. So, when working with a UINavigationBar , I expected to be able to do the same thing, first creating my custom view - from the Xib - then adding it as a custom view to the UIBarButtonItem : UIBarButtonItem *anItem = [[UIBarButtonItem alloc] initWithCustomView:_myCustomView]; Then adding to the nav bar: self.navigationBar.topItem.rightBarButtonItems = @[ anItem, anotherItem ]; So far so good. Now,

How to set different navigationbar color for different UIViewcontroller in xib?

不问归期 提交于 2019-12-10 02:52:20
问题 Iam trying to set different UINavigationBar color for different UIViewController in project.Till now i tried following code in ViewdidAppear methode of each UIViewController class and its not working still the color of navigationbar is not changing. UIImage *navBackgroundImage = [UIImage imageNamed:@"redbar.png"]; [[UINavigationBar appearance] setBackgroundImage:navBackgroundImage forBarMetrics:UIBarMetricsDefault]; Please help me 回答1: Try [[UINavigationBar appearance] setBarTintColor:

How to change the title of the UINavigationBar back button to “Back”

僤鯓⒐⒋嵵緔 提交于 2019-12-10 02:08:08
问题 When I push a view onto the navigation controller the back button's title get's set to the title of the previous view. How can I get the back button to just say "Back"? 回答1: Write this code in your viewwillappear : UIBarButtonItem *_backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil]; self.navigationItem.backBarButtonItem = _backButton; [_backButton release]; _backButton = nil; 回答2: In the previous view controller, have it set its

Hide navigation bar, but when I transition to the previous view (popped) it shows the old back button temporarily. Why?

怎甘沉沦 提交于 2019-12-10 01:21:32
问题 I have view controllers in a navigation controller (root: RootViewController , second: ReadingViewController ), but in the second view controller I want to disable the navigation bar for a UIToolBar (as I don't need the title and want more buttons, like in iBooks or the Facebook app). Problem is, when I hide the navigation bar in the second view, it appears randomly for a second again when I pop the view controller (go back). When I pop the view controller the back button appears for a second

Programmatically add a UINavigationBar that does underlap the status bar

烈酒焚心 提交于 2019-12-09 23:45:44
问题 I am adding a UINavigationBar manually in a View Controllers loadView . I am using Cartography (https://github.com/robb/Cartography) to layout views with Auto Layout. self.edgesForExtendedLayout = UIRectEdge.None let navBar = UINavigationBar() navBar.delegate = self view.addSubview(navBar) constrain(navBar) { bar in bar.top == bar.superview!.top bar.centerX == bar.superview!.centerX bar.width == bar.superview!.width } Delegate method: public func positionForBar(bar: UIBarPositioning) ->

Set titleview for all navigationcontroller and navigationitem

試著忘記壹切 提交于 2019-12-09 23:00:12
问题 [[[UINavigationBar appearance] setTitleView:button] I tried to set title view as button for all navigation item using above line of code but it is not working.How can I set title view for all navigation bars in my project by writing small code in appdelegate ? 回答1: Customizing the Appearance of a Navigation Bar it is alright to modify the barStyle, tintColor, and translucent properties, but you must never directly change UIView-level properties such as the frame, bounds, alpha, or hidden

NavigationBar background image for iOS 10 XCode 8.1 Swift 3.0

给你一囗甜甜゛ 提交于 2019-12-09 19:13:30
问题 How to set the background image for this specific settings? iOS10 and XCode8.1 ? I tried everything below: UINavigationBar.appearance().setBackgroundImage(UIImage(named: "navigationBg")!.resizableImage(withCapInsets: UIEdgeInsetsMake(0, 0, 0, 0), resizingMode: .stretch), for: .default) UINavigationBar.appearance().setBackgroundImage(UIImage(named: "navigationBg")! , for: .any, barMetrics: .default) UINavigationBar.appearance().setBackgroundImage(UIImage(named: "navigationBg")! , for: .default

Unable to dismiss CNContactViewController

断了今生、忘了曾经 提交于 2019-12-09 16:22:16
问题 I'm trying to let the user create a new contact. While I've got the screen to prompt the user to put in all his details there is no navigation bar at the top(Like there is in the default Apple Contacts app). There is no way to exit the scene. I'm using the ContactUI framework in swift 2.0 and Xcode 7.3. Here's the code: // create a new contact let createNewActionHandler = {(action: UIAlertAction) -> Void in let newContact = CNMutableContact() let contactPicker = CNContactViewController

Back-like arrow on iOS 7

ぃ、小莉子 提交于 2019-12-09 15:08:24
问题 I need to add a left bar button item in my app that looks like system back button, but is not the system back button, since it will appear on view controller that is the only vc of my navController's stack and execute my own code. Simply writing "Back" isn't really good for me, as I need to display the "<" arrow as well. Is there a way to programmatically create an arrow like that, without making image with that arrow? 回答1: Consider using a dummy UIViewController as a root view controller for

iOS8: How do I make statusBar opaque after navigationBar is hidden using hidesBarsOnSwipe?

核能气质少年 提交于 2019-12-09 15:05:01
问题 I am building iOS8 app. On my tableview controller, I am using self.navigationController.hidesBarsOnSwipe = YES, to hide the navigationBar on swipe up gesture. It is working nicely, but my statusBar becomes transparent and shows the table content underneath. On storyboard, Status Bar are Top Bar are set to "Inferred" I want to: 1. Keep my status bar opaque 2. Maintain the same color as the navigationBar 3. Table content scrolls underneath the statusBar Thank you. 回答1: Here is a Swift solution