uinavigationbar

UINavigationBar change Tint color with animation

[亡魂溺海] 提交于 2019-12-04 08:39:13
问题 Is it possible to change the tint with animation for a smoother effect? This doesn't work for me: [UIView beginAnimations:nil context:nil]; [self.navigationController.navigationBar setTintColor:[UIColor greenColor]]; [UIView commitAnimations]; I a not sure if it is even possible using native apple components as I guess they will be using CG to generate the gradient ... just want to find out before I'll start building my own solution ... Cheers guys :) 回答1: You wouldn't believe the length I

Animating UINavigationBar in iOS 7 (like Safari)

你。 提交于 2019-12-04 08:28:40
问题 When scrolling content in Safari, the title bar animates to a smaller version of its self. What is the best way to implement this? Currently, I am changing the size of the frame like so: - (void)scrollViewDidScroll:(UIScrollView *)scrollView { // // Table view // CGFloat currentPosition = scrollView.contentOffset.y - CGRectGetHeight(self.tableView.tableHeaderView.frame) + CGRectGetHeight(self.navigationController.navigationBar.frame) + CGRectGetHeight([[UIApplication sharedApplication]

iOS11 customize navigation bar height

我们两清 提交于 2019-12-04 08:07:06
问题 First of all, thank you for coming here and help solving my problem. Thank you!!! In iOS11 beta6, sizeThatFits: seems to not work on UINavigationBar. I notice that UINavigationBar structure has changed by Reveal my app. I have tried my best to change custom navigation bar's height. But it seems always to be 44 , and it works before iOS11. - (CGSize)sizeThatFits:(CGSize)size { CGSize newSize = CGSizeMake(self.frame.size.width, 64); return newSize; } Oddly, I just log its frame in

Restore navigationBar background image after setting it to [UIImage new]

可紊 提交于 2019-12-04 07:57:41
问题 I needed a completely transparent navigation bar for the mapView so I did this: [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImage new]]; That returns the desired effect, as seen here: Now I have a problem when I go to any other because my navigationBar remains transparent: How do I restore default settings of the navigationBar's backgroundImage and shadowImage? 回答1: Set

How do you determine the size/frame of a custom UINavigationItem.titleView?

旧街凉风 提交于 2019-12-04 07:47:17
After creating a custom view and assigning it to the navigationItem.titleView property it is displayed like this with the custom view filling the space between the two buttons. Therefore, the custom view is not centered on the navigation bar. How do I determine the frame of the view in the .titleView property? I want to center some text in the navigation bar, say under the time stamp. If you really want to get titleView 's frame (in your top-level view's coordinate space), you can do this: [self.navBar layoutIfNeeded]; CGRect titleViewFrameInTopLevelViewSpace = [self.navigationItem.titleView

Center elements vertically inside UINavigationBar with custom height

前提是你 提交于 2019-12-04 07:40:11
I'm developing an iOS 6 and 7 app that requires the navigation bar to be taller than the usual 44/64 pts I've searched high and low and so far it seems the cleanest solution is to use a category (or subclass) and implement the - (CGSize)sizeThatFits:(CGSize)size method to return a different size. This works fine in just making , however doing this causes all the items inside to rest at the bottom of the navigation bar, while I'd like to have them centered. I have tried using the Appearance Proxy protocol to define vertical offsets for the buttons, specifically this code [[UIBarButtonItem

IOS - Swift - adding target and action to BarButtonItem's customView

孤街浪徒 提交于 2019-12-04 07:07:03
I'm creating a custom view, with a uiimageview as a subview. I'm then using that custom view in my navigation bar as the rightBarButtonItem. This works to display the proper icon in the proper location, but for whatever reason the function I define in "action" is never being called, so the segue isn't performed when I tap on the rightBarButtonItem. Oddly enough if I do NOT insert a custom view, but instead comment that bit out and just set a title, target, and action for rightItem then the function is performed properly. somehow adding that custom view messes with the target and action

Trying to construct a tableview with a navigation bar at top

浪尽此生 提交于 2019-12-04 05:48:35
问题 Here's the code I used. What am I missing? - (void)loadView { CGSize screen_size = [[UIScreen mainScreen] bounds].size; CGFloat navBarHeight = 40; UINavigationBar *nav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, screen_size.width, navBarHeight)]; UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, navBarHeight, screen_size.width, screen_size.height - navBarHeight) style:UITableViewStylePlain]; table.autoresizingMask = UIViewAutoresizingFlexibleHeight

Change Both Title Text Color and Font in all Navigation Bars

浪尽此生 提交于 2019-12-04 05:25:21
问题 I am using swift 2 and the newest version of Xcode and I am trying to change the font size, name, and color of the Title Text in every Navigation Bar. I wrote the following code in my AppDelegate section in the didFinishLaunchingWithOptions area but it only changes the color, the size or type of font is not affected. When I get rid of the color line, then the title follows the NSFontAttributeName line. Is there a way to have both lines of code perform? I haven't found anything that allows you

No top navigation bar in a tab bar controller application

╄→гoц情女王★ 提交于 2019-12-04 05:22:27
I'm pretty new in iphone programming and have stumbled upon this issue which I guess should be pretty basic stuff. I am using a tab bar application created from a template in XCode IOS 5.1. It works fine and creates 3 screens in the storyboard (tab bar controller + + 2 descended views) but when I try adding a top bar to these 2 views there is a problem... I do this by adding the top navigation bar in interface builder from object inspector for the tab bar controller. After ticking this option the top bar shows perfectly in my storyboard for all 3 screens (tabbarcontroller + 2 descended views)