uinavigationbar

how to create back button in navigation bar

帅比萌擦擦* 提交于 2019-11-27 23:29:12
I have 2 page. first is tableView and second is view when I to click on any cell go on to next page (view) in way modal segue. I want add back button in next page of navigation bar . this is my code in view page : ViewController.m - (void)viewDidLoad { [super viewDidLoad]; self.lable.text = obji.Name; self.lable2.text = obji.Descript; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(Back)]; self.navigationItem.leftBarButtonItem = backButton; } - (IBAction)Back { //I dont know that how return pervious

Hide Status Bar and Increase the height of UINavigationBar

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 23:06:41
I am using story board to create navigation bar. My requirement is to hide the status bar and increase the height of Navigation bar. When i hide the status bar, the navigation bar sticks to top and the height is 44 px. i need a navigation bar height as 64 px (44px+status bar height). Is there any way to do this? With status bar Without status bar Kirit Modi To start off, you hide your statusBar by following these steps: First, put this code in viewWillAppear : [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; Second, set your info.plist file as

Setting Bar Button Item color in a custom navigation bar

岁酱吖の 提交于 2019-11-27 22:42:15
问题 I created a custom navigation bar and a right navigation button using the XIB. This works fine. But I need to to customize the tint color of the right navigation button. At the moment this tint color is the same color as tint color of navigation bar. I need a different color for this right button. Is there any way to change this color? Thank you. 回答1: Not to my knowledge, the button inherits the tint color of the navigationBar. What you can do is set a customView for the navigationItem: This

vertically aligning UINavigationItems

邮差的信 提交于 2019-11-27 22:28:57
I have customized the UINavigationBar's height to 100px and I'd like to add buttons onto this customized bar. All is good except the button seems to want to sit on the bottom of the nav bar no matter what. I can't get it to align to the center or the top of the nav bar. Here is the code; first I create a navigation controller in the app delegate and add one button on the right. // set main navigation controller temp *tempc = [[temp alloc] initWithNibName:@"temp" bundle:nil]; self.navigationController = [[UINavigationController alloc] initWithRootViewController:tempc]; UIBarButtonItem *navItem

“back” text displayed in iOS7 UINavigationBar when view title is long

廉价感情. 提交于 2019-11-27 22:20:34
问题 In my application,I need to show the previous viewController title to current viewController back title. Its working perfectly in iOS6. In iOS7,automatically the "back" title displayed other than the previous viewController title. how to fix the issue in iOS7? 回答1: In iOS 7 you will not be allowed to set the back button's title to be any longer than 11 characters. To avoid changing the title of the view controller, but to change the back button's title, you need to do this: In the previous

UIBarButtonItem Custom view in UINavigationBar

南楼画角 提交于 2019-11-27 22:03:58
I am making a custom bar buttons for uinavigationbar, I am using following code UIImageView *backImgView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"chk_back.png"]]; [backImgView setUserInteractionEnabled:YES]; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:backImgView]; [backButton setTarget:self]; [backButton setAction:@selector(BackBtn)]; checkIn_NavBar.topItem.leftBarButtonItem = backButton; The problem is it is not calling its action. What i am doing wrong? 来源: https://stackoverflow.com/questions/16057567/uibarbuttonitem-custom-view-in

Change width of a UIBarButtonItem in a UINavigationBar

主宰稳场 提交于 2019-11-27 21:16:52
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 *refreshBarButton = [[[UIBarButtonItem alloc] initWithCustomView:refreshButton] autorelease]; self

How to resize Title in a navigation bar dynamically

蓝咒 提交于 2019-11-27 20:33:45
I have some views that show up in a navigation controller. Two of these views have a longer title for the navigation bar. The problem is that when the title is too long to fit, some characters are truncated and "..." is added. Is there any way I can tell the Navigation bar to re-size the title text automatically to fit? jamil Used the below code in ViewDidload . Objective C self.title = @"Your TiTle Text"; UILabel* tlabel=[[UILabel alloc] initWithFrame:CGRectMake(0,0, 200, 40)]; tlabel.text=self.navigationItem.title; tlabel.textColor=[UIColor whiteColor]; tlabel.font = [UIFont fontWithName:@

iPhone Pushing View Controller in a left direction

て烟熏妆下的殇ゞ 提交于 2019-11-27 20:18:16
I have an app that has a centre view with two views off to each side of it. I want to have two navigation bar buttons, left and right which push a new navigation controller onto the view from the left or the right. When you change views by pushing a new view using the pushviewController: method of NavigationController, the view appears to slide in from the right. how do i change this to slide in from the left? Instead of using a navigation controller, I would just move the view. CGRect inFrame = [currentView frame]; CGRect outFrame = firstFrame; outFrame.origin.x -= inFrame.size.width; [UIView

Hide NavigationBar when scrolling tableView in CollectionView?

感情迁移 提交于 2019-11-27 20:16:51
I have collectionViewController and collectionViewCell include TableView.CollectionView is horizontal layout.I want hide navigationbar when scroll the tableView. Is there any idea about that. Andy Since iOS 8 you can just use self.navigationController?.hidesBarsOnSwipe = true This requires of course that your ViewController is embedded in a NavigationController. All child VC of the NavigationController will inherit this behaviour, so you might want to enable/disable it in viewWillAppear . You can also set the respective flags on the navigation controller in the storyboard. You can use some git