uinavigationitem

UINavigationController Back button title always show “Back”

泪湿孤枕 提交于 2019-12-24 03:55:11
问题 I am developing an IOS application. I am using navigation controller. If I push to next page then back button title not shown previous page title in IOS 7. Back button title always "Back" in IOS 7. I set all pages titles in viewWillAppear , viewDidload like below. But it is not working. self.navigationItem.title=@"Previous Page Title"; self.title = @"Previous Page Title"; What can I set back button title with previous page title in IOS 7 Thanx 回答1: If the title is large, back button shows

Make custom back button's clickable area smaller in Navigation controller

北慕城南 提交于 2019-12-23 22:52:52
问题 I've created a custom back button with the code below, however the clickable area is very big and goes well beyond the icon itself. Does anyone know how to set the clickable area, or make it the same size as the image? Thanks UIImage *buttonImage = [UIImage imageNamed:@"prefs"]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:buttonImage forState:UIControlStateNormal]; button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height); [button

How to manually add a Back button to my NavigationBar?

混江龙づ霸主 提交于 2019-12-23 15:10:29
问题 I would like to know how I can add a back button to my UINavigationBar , I know that If I embed in a Navigation Controller in my main view, that all of this would happen automatically, but that is not what I am trying to do, in fact, the back button could go to any other view I connect the segue to, doesn't even have to be the back. The back button needs to be the system navigation "back" button, I don't want to have to set image files for my buttons. I tried dragging in a bar button item in

Navigation item title view - same for all pushed view controllers

狂风中的少年 提交于 2019-12-23 07:45:10
问题 How can you keep navigation item title view same for all pushed view controllers? E.g. I'd like to set title view to a logo that should be visible for all screens. UIImage *logoImage = [UIImage imageNamed:@"navigation-bar-logo"]; UIImageView *titleLogo = [[UIImageView alloc] initWithImage:logoImage]; self.navigationItem.titleView = titleLogo; If I set it for each view controller individually, it looks strange with the iOS7 navigation bar animation. 回答1: One way to do this is to use

Change BackBarButtonItem for All UIViewControllers?

守給你的承諾、 提交于 2019-12-23 05:16:14
问题 I would like to change the BackBarButtonItem on all the views in my iOS app so that they show just the back arrow with no text. Is the only way to accomplish this is to go through every UIViewController and set the self.navigationItem.backBarButtonItem.title ? Seems I should be able to create a superclass to define the default value of backBarButtonItem.title , but I am not sure where to start. Thank you for your help. 回答1: You don't need to change it on every view controller class. You can

Custom navigationItem animation

佐手、 提交于 2019-12-23 04:48:14
问题 I want a custom animation on the leftBarButtonItem: UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self action:@selector(onMenuButtonTouch)]; viewController.navigationItem.leftBarButtonItem = menuButton; My UINavigationController pushes and pops views with a custom animation so the leftBarButtonItem doesn't have any animations at the moment. [self.navigationController pushViewController:myViewController animated:NO];

How to add a UIBarButtonItem programmatically?

白昼怎懂夜的黑 提交于 2019-12-22 23:42:14
问题 what's the proper way to add a UIBarButtonItem programmatically? In my case I'm trying to add one to the rightBarButtonItem and I've been hopping round the controller hierarchy but I can't seem to get the button to show up anywhere. Here's my current code: - (void)viewDidLoad { [super viewDidLoad]; [self.navigationItem setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithImage:[[UIImage alloc] initWithContentsOfFile:@"Barcode-White.png"] style:UIBarButtonItemStylePlain target:self action:

Wrong placement of search text field inside search bar on iOS 11

梦想与她 提交于 2019-12-22 10:44:39
问题 I am using UISearchController as part of navigation bar using the new APIs introduced in iOS 11. I am using it in the following manner in my ViewController's viewDidLoad - (void)viewDidLoad { [super viewDidLoad]; [_table setDataSource:self]; [_table setDelegate:self]; searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; [self.navigationItem setSearchController:searchController]; [self.navigationItem setHidesSearchBarWhenScrolling:NO]; [searchController

How do I set custom navigation bar(title + titleView) for all navigation controllers and view controller?

倾然丶 夕夏残阳落幕 提交于 2019-12-22 09:39:39
问题 I have a tabbed application with navigation controllers in tabs and view controller in them. All of them use the same navigation controller navigation bar: back button + logo image. Currently, I'm placing this code in every view controller: - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Back"; UIImage *headerImage = [UIImage imageNamed:@"Logo.png"]; self.navigationItem.titleView = [[[UIImageView alloc] initWithImage:headerImage] autorelease]; } IMHO it's not the best

How to create a UINavigationItem.TitleView based upon a nib file?

蓝咒 提交于 2019-12-22 00:48:53
问题 I have a UINavigationController bassed sequence of screens. On one of the screens I want to replace the standard title with a custom TitleView. The custom view will be created with a nib file and will have an image and several labels. Do I create a UIViewController w/ associated nib file, load the nib, and assign the .view property to the TitleView? Basically, how do I use a nib where I can layout the necessary elements and then assign the resulting view to the TitleView property? 回答1: