uinavigationbar

Change iPhone navigation bar's height

不羁岁月 提交于 2019-11-27 07:55:26
My client can't read iPhone's default fonts, the size is too small. I have an application with a navigation bar and I need to make everything in it bigger, for example, the font's size. IB doesn't seem to allow this... any help? Many thanks! Andrey Tarantsov Update: today (2012) there is a much bigger tendency towards custom UIs, so I would say the answer below is way too harsh. There is still no supported way of customizing height, though, but you can certainly derive from UINavigationBar and override some sizing methods. This probably will not get you rejected (although it is still a grey

Changing the UINavigationBar background image

懵懂的女人 提交于 2019-11-27 07:37:46
I've been trying to change the background image of the UINavigationBar of my application. I tried several ways. First I added to my AppDelegate class the following code: @implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"navigationbar.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; } @end But it wasn't working. My next try was to write a CustomizedNavigationBar Class which is overriding the drawRect method. It looked like that: CustomizedNavigationBar.h #import <UIKit/UIKit.h>

UIBarButtonItem changing title not working

≯℡__Kan透↙ 提交于 2019-11-27 06:35:13
问题 How can I change the title of a UIBarButtonItem? I have the following code which is called when an "edit" button is pressed on my UINavigationBar. -(void)editButtonSelected:(id)sender { NSLog(@"edit button selected!"); if(editing) { NSLog(@"notediting"); [super setEditing:NO animated:NO]; [tableView setEditing:NO animated:NO]; [tableView reloadData]; [rightButtonItem setTitle:@"Edit"]; [rightButtonItem setStyle:UIBarButtonItemStylePlain]; editing = false; } else { NSLog(@"editing"); [super

iPhone: Setting Navigation Bar Title

。_饼干妹妹 提交于 2019-11-27 06:13:34
Hey all. I'm still pretty new to iPhone development, and I'm having a bit of trouble figuring out how to change the title of my Navigation Bar. On another question on this site somebody recommended using : viewController.title = @"title text"; but that isn't working for me...Do I need to add a UINavigationController to accomplish this? Or maybe just an outlet from my UIViewController subclass? If it helps, I defined the navigation bar in IB and I'm trying to set its title in my UIViewController subclass. This is another one of those simple things that gives me a headache. Putting self.title =

Dark shadow on navigation bar during segue transition after upgrading to Xcode 5.1 and iOS 7.1

你说的曾经没有我的故事 提交于 2019-11-27 06:08:20
When I am navigating back & forth between parent and child controllers in a master - detail navigation controller, i see a dark shadow on the right side of navigation bar at top. It started after I upgraded to Xcode 5.1. It feels rough and distracting. How can I get rid of it? self.navigationController.view.backgroundColor = [UIColor whiteColor]; I solved this problem by setting the background color of the navigation controller's view. self.navigationController.navigationBar.translucent = NO; fixed it nonamelive's answer is perfect. To achieve the same thing in Interface Builder AND STILL KEEP

UINavigationItem titleView “ignored if leftBarButtonItem is set”?

时光总嘲笑我的痴心妄想 提交于 2019-11-27 05:56:29
问题 The documentation for UINavigationItem's titleView property says: "This property is ignored if leftBarButtonItem is not nil." However, I've set both the titleView and leftBarButtonItem properties in my testing and they both appear to show up fine. I've tested on all the simulators in my Xcode: 4.3, 5.0, and 5.1. Does anyone know if the documentation is just wrong, or is it correct on some older versions (e.g. 4.2, 3.x) that I haven't been able to test? 回答1: Check the documentation for

UIBarButtonItem with custom view not properly aligned on iOS 7 when used as left or right navigation bar items

試著忘記壹切 提交于 2019-11-27 05:56:20
The following code works up through iOS 6: UIButton *myButton = nil; myButton = [UIButton buttonWithType:UIButtonTypeCustom]; myButton.bounds = CGRectMake(0,0,44,30); // setup myButton's images, etc. UIBarButtonItem *item = nil; item = [[UIBarButtonItem alloc] initWithCustomView:customButton]; This is how the button is supposed to be aligned: However, on iOS 7, the button appears to be offset from the right or left by too many pixels: How can I get my custom bar button items to be aligned properly? malex Works until iOS11! You can use negative flexible spaces and rightBarButtonItems property

How to hide a navigation bar from first ViewController in Swift?

独自空忆成欢 提交于 2019-11-27 05:53:21
How can I hide a navigation bar from first ViewController or a particular ViewController in swift? I used the following code in viewDidLoad() : override func viewDidLoad() { super.viewDidLoad() self.navigationController?.isNavigationBarHidden = true } and also on viewWillAppear : override func viewWillAppear(animated: Bool) { self.navigationController?.isNavigationBarHidden = true } Both methods hide the navigation controller from all ViewControllers. If you know that all other views should have the bar visible, you could use viewWillDisappear to set it to visible again. In Swift: override

Navigation bar show/hide

痴心易碎 提交于 2019-11-27 05:52:30
I have an app with a navigation bar consisting of 2 bar buttons. I would like to hide and show this navigation bar when a user double taps the screen. Initially, the navigation bar should be hidden. When a user double taps the screen, the navigation bar should come up with an animation, like what can be seen in the iPhone's photo gallery. How can i do something this? Suggestions are always appreciated. Alex Reynolds This isn't something that can fit into a few lines of code, but this is one approach that might work for you. To hide the navigation bar: [[self navigationController]

Change the alpha value of the navigation bar

ぐ巨炮叔叔 提交于 2019-11-27 05:29:47
问题 Is this possible? I want to change the alpha value of the navigation bar in my view controller (in an animation), but if I do self.navigationController.navigationBar.alpha = 0.0; , the portion of the screen the navigationBar took up totally disappears and leaves a black box, which is not what I'd like (I'd prefer it to be the color of self.view 's background). 回答1: As I support Colin's answer, I want to give you an additional hint to customize the appearance of an UINavigationBar including