uinavigationbar

iOS - UINavigationController, Hide navigationBar

老子叫甜甜 提交于 2019-12-21 08:17:23
问题 I have a minor trouble hiding the navigationBar for my UINavigationController I have added: self.navigation!.navigationBar.hidden = true This, unfortunately leaves some kind of background (white) left behind the white status bar that pushes the content (green) downwards, and an unwanted scroll behaviour where I can drag the content up and down to show/hide the white background. What I need is for the statusbar to take up no vertical space what so ever and lay on top of the content (green) How

How do I add UIImage to center of UINavigationBar?

笑着哭i 提交于 2019-12-21 07:56:31
问题 My problem is that I have an image with width = 44 and height = 44 . This method didn't work properly. [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"image_44.png"] forBarMetrics:UIBarMetricsDefault]; How do I add an UIImage to center of an UINavigationBar ? 回答1: Try this: UIImageView *titleView = [[UIImageView alloc] initWithImage:myUIImage]; [self.navigationItem setTitleView:titleView]; 回答2: Using Swift : var titleView = UIImageView(image: UIImage(named:

UIBarButtonItems shift position when UINavigationController is presented modally

时光总嘲笑我的痴心妄想 提交于 2019-12-21 07:55:15
问题 I'm presenting a UINavigationController modally, from within an iOS app extension: UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; nav.modalPresentationStyle = UIModalPresentationFormSheet; nav.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentViewController:nav animated:YES completion:nil]; When the navigation controller appears, its root view controller's UIBarButtonItems jump position: I'm creating and adding the buttons

Hide Navigation Bar but not the back button

…衆ロ難τιáo~ 提交于 2019-12-21 06:40:06
问题 i hide my navigation using: [self.navigationController setNavigationBarHidden:YES animated:YES]; But i need to not hide the back button, it's Possible? 回答1: nevan king is right but you can simply change the background image of the navigation bar or set it to nil. If you set it to nil or provide a transparent BG-image you would achieve the effect you need. For iOS >= 5.0 you could simply set the appearance: if([navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) //

Hide Navigation Bar but not the back button

半腔热情 提交于 2019-12-21 06:39:17
问题 i hide my navigation using: [self.navigationController setNavigationBarHidden:YES animated:YES]; But i need to not hide the back button, it's Possible? 回答1: nevan king is right but you can simply change the background image of the navigation bar or set it to nil. If you set it to nil or provide a transparent BG-image you would achieve the effect you need. For iOS >= 5.0 you could simply set the appearance: if([navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) //

iphone - programmatically change navigation bar button to activity indicator

岁酱吖の 提交于 2019-12-21 06:05:32
问题 I have added a refresh UIBarButtonItem to my navigation bar on my iPhone app. When the user taps the button I'd like the refresh button to change to the animated activity indicator and once the operation (in this case a download) is complete switch the activity indicator back to the refresh button. I have added the refresh button using IB. Then on the button tap I create a new activity indicator and keep an pointer to the original refresh button. Like so: refreshButtonItem = self

UINavigationBar: intercept back button and back swipe gesture

筅森魡賤 提交于 2019-12-21 05:46:16
问题 I have a UINavigationBar that intercepts the back button tap that alerts the user if there are unsave changes. This is based on the solution presented in UINavigationController and UINavigationBarDelegate.ShouldPopItem() with MonoTouch using the UINavigationBarDelegate protocol and implementing - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; Now, iOS7 has introduced the swipe-to-go-back gesture, and I'd like to intercept that as well, but can't

NavigationBar setShadowImage not always working

久未见 提交于 2019-12-21 05:15:37
问题 I'm trying to set a custom shadow image for the navigation bar in my table views, but it's only showing in some views. I've created a super class to set the styles for my table views. - (void)viewDidLoad { [super viewDidLoad]; // Set navigation bar background [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationbarbackground.png"] forBarMetrics:UIBarMetricsDefault]; // Set navigation bar shadow imag [self.navigationController.navigationBar setShadowImage

ios Title and Subtitle in Navigation Bar centered

孤街醉人 提交于 2019-12-21 05:01:07
问题 I'm trying to have two UILabels in my navigation bar instead of just one. I followed this link to have informations on how to do that: iPhone Title and Subtitle in Navigation Bar It works well, but I can't get my texts to be centered properly. It is centered between the buttons, but the default title behaviour is to center itself right under the time. I had a look here, same question, but no answer: UINavigationBar TitleView with subtitle What am I missing? Here is my code: CGRect

iOS 7 UINavigationBar appearance not working first time…

你离开我真会死。 提交于 2019-12-21 03:28:30
问题 I am trying to change the look of the UINavigationBar in my iOS7 app. I am doing the following: - (void)viewDidLoad { [super viewDidLoad]; m_sNumberToCall = @""; UIBarButtonItem * btn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"IconHome.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(btHomeTouched:)]; self.navigationItem.leftBarButtonItem = btn; self.navigationController.navigationBar.translucent = YES; [[UINavigationBar appearance] setBackgroundImage: