uinavigationbar

Animate a UINavigationBar's barTintColor

自古美人都是妖i 提交于 2019-12-20 09:55:41
问题 The app I'm working on changes the barTintColor of its navigation bar when pushing new view controllers. Right now we set that colour in the destination view controller's viewWillAppear: method, but we have a few issues with that. With the way we're doing this right now, the navigation bar's colour changes abruptly, while the rest of the bar content animates as usual. What I'd like is for the bar to fade between the source and destination colour. Is there any way to achieve this with public

How to put an image in the center of navigationBar of a UIViewController?

橙三吉。 提交于 2019-12-20 09:16:11
问题 I have this snippet of code used in viewDidLoad of a UIViewController. I'va no errors. Images exists. I get the background but not the image. Image is a sort of logo. if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) { /* Background of navigationBar. */ UIImage * navigationBarImage = [UIImage imageNamed:@"01_navbar_portrait.png"]; [self.navigationController.navigationBar setBackgroundImage:navigationBarImage forBarMetrics

Hide back button in navigation bar with hidesBackButton in Swift

此生再无相见时 提交于 2019-12-20 08:57:18
问题 I want to hide the back button when transitioning from one view to another. I read the questions regarding this problem and every answer was "use hidesBackButton ". The problem with this is: when I put it in viewDidLoad/viewWillAppear the back button arrow hides but the string "Back" doesn't. when I put it in viewDidAppear the back button disappears but it visible to the user How can I fix this? Edit: Here is how you can replicate this problem(or bug?) Make a new Tabbed application with Swift

Custom UINavigationBar with custom height causes the UIBarButtonItem's to be positioned wrong

China☆狼群 提交于 2019-12-20 08:49:48
问题 I created my own subclass of UINavigationBar in order to enable custom background that is taller than 44pxs. I did it by overriding these two methods: -(void) drawRect:(CGRect)rect { [self.backgroundImage drawInRect:CGRectMake(0, 0, self.backgroundImage.size.width, self.backgroundImage.size.height)]; } - (CGSize)sizeThatFits:(CGSize)size { CGRect frame = [UIScreen mainScreen].applicationFrame; CGSize newSize = CGSizeMake(frame.size.width , self.backgroundImage.size.height); return newSize; }

Custom Back Button With Image

自古美人都是妖i 提交于 2019-12-20 07:49:03
问题 What I'd like to do is alter the height of the back button. However, as I understand it, the only option to alter is width. So, I thought I'd create a custom back button with my own, smaller, image. Now I've done this using the viewDidLoad method with the code below: //Setup navigation bar navigationController?.navigationItem.backBarButtonItem = UIBarButtonItem(image:UIImage(named:"back_arrow.png"), style:UIBarButtonItemStyle.Plain, target:nil, action:nil) navigationController?.navigationItem

Adding multiple custom bar buttons to custom nav bar

筅森魡賤 提交于 2019-12-20 07:16:49
问题 I need to add two bar button items to each end of my custom navigation bar in Swift. I'm using the following method, and although I get no errors, nothing at all is appearing. I'm using my own custom icons, which do appear when I add them using interface builder. Obviously, I can only add one to each end that way. @IBOutlet weak var navBar: UINavigationBar! override func viewDidLoad() { var iconOne = UIImage(named: "iconOne") var iconTwo = UIImage(named: "iconTwo") var buttonOne

How to add scope buttons in a UISearchController embedded in UINavigationController

狂风中的少年 提交于 2019-12-20 06:56:41
问题 I have an App that is presenting a MKMapView embedded in a UINavigationController. In the UINavigationController I have put a UISearchController. When the User touch the UISearchController it displays a UITableViewController. It works well while I'm not adding the Scope button in the UISearchController. Here the screenshot of the UISearchController in the UINavigationController when I start the App. Next when I touch the UISearchController, it displays the UITableViewController and scope

Custom rightBarButtonItem disappearing

半城伤御伤魂 提交于 2019-12-20 06:37:23
问题 I have a strange bug with a custom rightBarButtomItem in the NavBar. I have a TabBar application. If the app is loaded the button shows up correct. If i click through the tabs the button keeps showing. If i go back to one of the tabs which was already shown the button disappears. At the end the button only shows randomly in one of the tabs. My code works perfectly if i set a standard rightBarButtomItem programatically. But not with custom graphics. If a ChildViewController is pushed and

Custom UINavigationBar background image appears darker than the original image

左心房为你撑大大i 提交于 2019-12-20 06:26:48
问题 I am customizing a UINavigationBar like so: UIImage * img = [UIImage imageNamed:@"background.png"]; [[UINavigationBar appearance] setBackgroundImage:img forBarMetrics:UIBarMetricsDefault]; My original image background.png looks like this: It has a flat color #4b0367 The resulting NavigationBar looks like this: It has the color #311253 which is different from the original! Apparently UIKit changes the color. Note: Setting tintColor had no effect. Setting a transparent background image + a

Displaying notification badge like counter in UINavigationbar

拈花ヽ惹草 提交于 2019-12-20 04:38:46
问题 I have a requirement to display number of pending notifications in iPhone navigation bar. The appearance should be like that of notification badge - but these are not APNS notifications. They are the ones sent from private server with similar purpose. I tried adding a right/left button ( UIBarButtonItem ) in my UINavigationbar but it seems like it is very rigid in appearance. I can't set its width, fonts etc. See my code: self.notifButton = [[UIBarButtonItem alloc] initWithTitle:@"0" style: