uinavigationitem

navigationController.navigationItem vs navigationItem

﹥>﹥吖頭↗ 提交于 2019-12-28 06:27:14
问题 Just curious, why setting self.navigationItem = ... works, but self.navigationController.navigationItem fails? The same applies for self.toolbarItems vs self.navigationController.toobarItems . When to use self.navigationController.navigationItem ? Maybe you will say, they point to different things. but why self.navigationController.navigationBarHidden = YES the navigation bar is hidden. doesn't it means self.navigationController.navigationItem point to the bar i wanted? 回答1: The class

Change width of a UIBarButtonItem in a UINavigationBar

只愿长相守 提交于 2019-12-28 04:01:09
问题 I am creating a UIBarButtonItem and adding it to my navigation bar like so: (void)viewDidLoad { ... // Add the refresh button to the navigation bar UIButton *refreshButton = [UIButton buttonWithType:UIButtonTypeCustom]; [refreshButton setFrame:CGRectMake(0,0,30,30)]; [refreshButton setImage:[UIImage imageNamed:@"G_refresh_icon.png"] forState:UIControlStateNormal]; [refreshButton addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem

back button callback in navigationController in iOS

前提是你 提交于 2019-12-28 03:18:05
问题 I have pushed a view onto the navigation controller and when I press the back button it goes to the previous view automatically. I want to do a few things when back button is pressed before popping the view off the stack. Which is the back button callback function? 回答1: William Jockusch's answer solve this problem with easy trick. -(void) viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // back button was pressed. We know

UINavigationItem out of sync when using popToRootViewController

最后都变了- 提交于 2019-12-25 06:47:34
问题 I tap a tab bar item, which triggers poptoRootViewControllerAnimated. Most of the time it works as expected, but in some cases it pops to the correct view, but the navigation item is out of sync, "stuck" from the view i previously was at. I've read about people having this problem with iPad's, when in landscape mode, but the solutions I've found don't work in this case. This is an iPhone app in portrait mode. Happens with the simulator as well as on an actual iPhone. If someone has a

Detect and handle, or override, clicks on a navigation bar

为君一笑 提交于 2019-12-25 03:15:24
问题 I have an app where I've pushed two items onto the navigation bar. The top item, which ends up as a 'back' button, should have the function to jump all the way back to the start page, which is a list of web news. The other one simply displays a logo. The boss wants a navigation bar look and feel but with a simple function, so the user can click around the news site, but always be able to jump to the news list page with just the one click. Is the only option to create a fixed navbar with two

UINavigationItem title label set width?

别说谁变了你拦得住时间么 提交于 2019-12-25 01:46:09
问题 In my UIViewController i set my title dynamically so i do not know the length of the string that will be shown in the navigation bar and because of that i have the current situation: alt text http://img94.imageshack.us/img94/2484/picture3vf.png is there any way to set the width of the label that displays the title in the navigation bar? or should i think of a with, compare the text length to it and if it is too long should i resize it and display the famous "..." ? I know that i can add an

Adjust position of custom Navigation Back Button

一个人想着一个人 提交于 2019-12-24 18:48:31
问题 I am using a custom image as the back button of my Navigation Controller but the problem is that the image is not aligned correctly with the title and the right button item. I've been trying to move the back button down a few pixels with no success. extension UINavigationController { func addBackButton() { let imgBack = UIImage(named: "ic_back") navigationBar.backIndicatorImage = imgBack navigationBar.backIndicatorTransitionMaskImage = imgBack navigationBar.topItem?.backBarButtonItem =

How to customize UINavigationBar for the entire app?

你说的曾经没有我的故事 提交于 2019-12-24 12:30:02
问题 This is a bit different question than the previously asked. So be nice . The entire app has a navigation bar with different colors. The entire app has few options in its navigation bar. They all are same. What am I expecting ? I have created this extension for UINavigationController and able to change the navigation bar's background color as per the view controller I will be. extension UINavigationController { func updateNavigationBar(withViewControllerID identifier: String?) {

How to add spacing to Left BarButtonItem Image with Swift 3

强颜欢笑 提交于 2019-12-24 09:57:44
问题 I would like to add space to the left of the bar button. So, I add this code. navbar.autoresizingMask = [.flexibleWidth, .flexibleBottomMargin, .flexibleRightMargin] navbar.delegate = self UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green:49.0/255.0, blue:79.0/255.0, alpha:0.1) UINavigationBar.appearance().tintColor = UIColor.white UINavigationBar.appearance().isTranslucent = true UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName :

Tabbar Item in Swift

≡放荡痞女 提交于 2019-12-24 08:30:07
问题 I have some issue in Tabbar controller . I put " FAQ " tab bar item in the bottom. When the app runs on the small screen devices, it automatically appears in More section. The problem is that I put "Nav Bar" in FAQ view controller. For large screens (ipad), FAQ bar item shows in bottom. When Navbar item goes to More section, navbar is appear as two bar. One bar is that I make and another bar is default bar. My current problem solving way is if (UIDevice.current.userInterfaceIdiom ==