uinavigationbar

UINavigationBar gradient details

喜夏-厌秋 提交于 2019-11-27 12:36:08
问题 I'm trying to recreate the look of a UINavigationBar. The background of the bar is drawn using a gradient, but it's unclear exactly what the default colors and points are in it. Has anyone done anything in this area? 回答1: From one of my projects. Adjust the colors to your liking. It also can show a background image if you want (imageReady), else it draws the navbar like Apple's // #Lighter r,g,b,a #Darker r,g,b,a #define MAIN_COLOR_COMPONENTS { 0.153, 0.306, 0.553, 1.0, 0.122, 0.247, 0.482, 1

how to hide navigationbar when i push from navigation controller?

我们两清 提交于 2019-11-27 12:35:29
how to hide top bar in UIViewcontroller when i push from navigation controller using pushViewController ? any help please? Put this code in the view controller you want to hide the navigation bar for. - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:animated]; } And you may also want to stick this in there, depending on your needs: - (void) viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.navigationController setNavigationBarHidden:NO animated:animated]; } Here's how to do it in

iOS 11 navigationItem.titleView Width Not Set

倖福魔咒の 提交于 2019-11-27 11:38:15
问题 Seeing a behavior on iOS11 with a navigationItem.titleView where the width of the titleView is not the full width of the screen. I have a custom view that I set as the titleView. Previous to iOS11 the view would fill the navigation bar area. But iOS 11 it is not resizing to fill the width of the screen. I've tried setting the frame of the view before setting titleView but no luck. I've tried to force the titleViews superview to layout constraints as well but no luck. Screenshots attached:

Navigation stack becomes unusable after canceling iOS 7 back swipe gesture

﹥>﹥吖頭↗ 提交于 2019-11-27 11:35:27
问题 I am running into an issue where my navigation controller becomes unusable after initiating then canceling the new iOS 7 back swipe gesture. Some relevant information: My app has a home page with various activity pages. The home page hides the navigation bar in viewWillAppear The home page un-hides the navigation bar in viewWillDisappear -(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // Let's hide the navbar when we show the home view [self.navigationController

center custom title in UINavigationBar?

落爺英雄遲暮 提交于 2019-11-27 11:18:02
问题 I have a custom UINavigationBar title and a custom back button. My problem is that the title is not centered on the iPhone. It is as if my back button is pushing the title over to the right. Any Idea how I can center it? int height = self.navigationController.navigationBar.frame.size.height; int width = self.navigationController.navigationBar.frame.size.width; UILabel *navLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width + 300, 20)]; navLabel.backgroundColor = [UIColor whiteColor]

How to prevent status bar from overlapping content with hidesBarsOnSwipe set on UINavigationController?

风格不统一 提交于 2019-11-27 11:14:10
I'm trying to use the new feature added in iOS 8 - hiding the navigation bar while user is scrolling the table view (similar to what mobile Safari does). I'm setting the property hidesBarsOnSwipe of UINavigationController to YES in viewDidAppear method of UITableViewController : - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if([self.navigationController respondsToSelector:@selector(hidesBarsOnSwipe)]) { self.navigationController.hidesBarsOnSwipe = YES; } } The navigation bar hides when the view is being scrolled. So far so good. But the status bar is still visible and

NSFontAttributeName has changed to String

試著忘記壹切 提交于 2019-11-27 11:07:07
问题 i'm trying to style the navigation bar properly, i need to change the font to helvetica neue with a size point of 19. I've ever used this code but i've notice that now doesn't work as well: navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: 19)] this happens because the type of NSFontAttributeName has changed to String, i've tried to fix it with navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName

Change the navigation bar's font

本小妞迷上赌 提交于 2019-11-27 11:05:11
The question is plain easy and simple, the answer unfortunately not. How can you change the font of the text in the UINavigationBar ? Aravindhan From iOS 7 and later: NSShadow* shadow = [NSShadow new]; shadow.shadowOffset = CGSizeMake(0.0f, 1.0f); shadow.shadowColor = [UIColor redColor]; [[UINavigationBar appearance] setTitleTextAttributes: @{ NSForegroundColorAttributeName: [UIColor greenColor], NSFontAttributeName: [UIFont fontWithName:@"Helvetica" size:20.0f], NSShadowAttributeName: shadow }]; From iOS 5 and later: [[UINavigationBar appearance] setTitleTextAttributes: @{

How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem?

為{幸葍}努か 提交于 2019-11-27 11:01:00
I got the opposite issue from here . By default in iOS7 , back swipe gesture of UINavigationController 's stack could pop the presented ViewController . Now I just uniformed all the self.navigationItem.leftBarButtonItem style for all the ViewControllers . Here is the code: self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:LOADIMAGE(@"back_button") style:UIBarButtonItemStylePlain target:self action:@selector(popCurrentViewController)]; after that, the navigationController.interactivePopGestureRecognizer is disabled. How could I make the pop gesture enabled without

Warning frame for “Navigation bar” will be different at run time appears in Xcode 8 Swift 3

泪湿孤枕 提交于 2019-11-27 10:37:57
Before I've upgraded to Xcode 8 I haven't seen this error in such case. I have different Navigation Controllers. For all of them I see an error Frame for "Navigation bar" will be different at the run time. Navigation bar "Expected: width=384, Actual: width=375 . In reality these Navigation Controllers doesn't have Navigation bar . Navigation bar exists for subviews. Anyway I could solve it by tick and untick the checkbox Shows navigation bar in Attributes inspector . But unfortunately every time I reopen Main.storyboard this warning appears again. Also if I click on yellow triangle and then on