uinavigationbar

iOS 7 UINavigationController NavBar per controller color animation

旧街凉风 提交于 2019-11-28 08:45:48
Is there any way to have different barTintColor of UINavigationController 's UINavigationBar on different pushed controllers with smooth color transition animation ? I'd like to have a smooth animation of UINavigationBar 's tint color during UINavigationController 's push/pop animation and ideally also interactive pop (gesture based controller pop). Why do I need this? I'd like to have 1 controller in the navigation stack to have different tint color indicating status of some task (red / green etc.). What I have tried so far: viewWillAppear (view lifecycle) methods, but there is no way to

Adding constraints to a UIBarButtonItem

最后都变了- 提交于 2019-11-28 08:21:20
问题 Xcode is not allowing me to put constraints on my BarButtonItem on a ViewController in the MainStoryBoard. It's appearing too far to the left where it's unreadable as shown in the image. The image below shows where the BarButtonItem is. It's supposed to say "Item". I also looked on the preview split screen on Xcode and it looked fine for the iPhone6 but not for the iPhone 4 (it's half cut on the iPhone 4 but here its 3/4s cut). Here I'm running for the iPhone 6 and i get that. How do I add

Customize navigation bar with title view

天大地大妈咪最大 提交于 2019-11-28 06:15:55
I am trying to add a custom view in the center of a navigation bar and I am using the following code to test it: UIView * testView = [[UIView alloc] init]; [testView setBackgroundColor:[UIColor blackColor]]; testView.frame = CGRectMake(0, 0, 100, 35); [self.navigationController.navigationItem.titleView addSubview:testView]; I am setting this up in the viewDidLoad method of my view controller but when i run my program nothing seems to change in my navigation bar. Could you help me with this? This works. Give frame at the time of initialisation UIView *iv = [[UIView alloc] initWithFrame

UINavigationBar autoresizing

懵懂的女人 提交于 2019-11-28 06:02:43
In my app, I got a UINavigationController. Unfortunately, when I rotate the device and the interface orientation changes, the UINavigationBar doesn't change its height. In other iPhone applications, such as the Contacts.app, the navigation bar gets slightly less tall in landscape mode. It must be built-in, because if you take the navigation sample app from the XCode menu and add interface orientation to it, it does change the navigation bar's height properly. How can I make the navigation bar resize like it does in all other iPhone apps I've seen? I've done a little testing, and although I don

UINavigationBar UIBarButtonItems much larger click area than required

和自甴很熟 提交于 2019-11-28 05:45:11
hopefully someone can help me out- iv'e scoured the net for the answer and cannot find one- the UIBarButtonItems added to UINavigationBar have a much larger click area than required- for example, open up any project you have a nav bar with buttons on- click anywhere between the end of the button and the title of the nav bar- the button clicks, when you clearly did not click on the button- also try this- click underneath the nav bar, below the button, the button clicks for about 5+ pixels below the nav bar- my problem is this- i have added a custom header with buttons to a tableview- but when i

UINavigationController interactivePopGestureRecognizer working abnormal in iOS7

孤街浪徒 提交于 2019-11-28 05:31:25
In iOS7, we have a new "swipe left to right" gesture, this is a very useful feature, but now I have a problem with it. I use this code to custom the back button in UINavigationBar . self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view]; but this will disables the "swipe left to right" gesture, so I use the follow code to keep the gesture enabled. self.navigationController.interactivePopGestureRecognizer.delegate = self And then, I found that the gesture is working abnormal, if current ViewController has a tableView, when the tableView is scrolling, the

Change the alpha value of the navigation bar

拥有回忆 提交于 2019-11-28 05:06:10
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). As I support Colin's answer, I want to give you an additional hint to customize the appearance of an UINavigationBar including the alpha. The trick is to use UIAppearance for your NavigationBar. This enables you to assign an UIImage to

adding more than two button on the navigationbar

戏子无情 提交于 2019-11-28 05:04:43
I am trying this but it does not work. -(void)viewDidLoad { // create a toolbar where we can place some buttons UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 45)]; [toolbar setBarStyle: UIBarStyleBlackOpaque]; // create an array for the buttons NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3]; // create a standard save button UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveAction:)]; saveButton.style = UIBarButtonItemStyleBordered; [buttons addObject

Can't set titleView in the center of navigation bar because back button

我只是一个虾纸丫 提交于 2019-11-28 04:38:39
I'm using an image view to display an image in my nav bar. The problem is that I can't set it to the center correctly because of the back button. I checked the related questions and had almost the same problem earlier that I solved, but this time I have no idea. Earlier I solved this problem with fake bar buttons, so I tried to add a fake bar button to the right (and left) side, but it doesn't helped. - (void) searchButtonNavBar { CGRect imageSizeDummy = CGRectMake(0, 0, 25,25); UIButton *dummy = [[UIButton alloc] initWithFrame:imageSizeDummy]; UIBarButtonItem *searchBarButtonDummy =[

iOS7 - Change UINavigationBar border color

二次信任 提交于 2019-11-28 03:29:24
Is it possible to change the grey border-bottom color of the UINavigationBar in iOS7? I already tried to remove to border, but this is not working: [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]]; Thanks! This will help you :) [self.navigationController.navigationBar.layer setBorderWidth:2.0];// Just to make sure its working [self.navigationController.navigationBar.layer setBorderColor:[[UIColor redColor] CGColor]]; You are removing the shadow but not the border, you need to do the following: [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init]