I'm create a new clean Xcode project with a "UITabBarController" and UIViewController (embedded in "UINavigationController").
The "UINavigationController" has enable "Prefer Large Title" to 'always'.
I add two IBAction for collapse/expand in the "UIViewController"" for the NavigationBar", but the follow code not works. After my research I read, i must set prefersLargeTitles
to TRUE
or FALSE
, but nothing happens when the IBAction calls.
Here is my Code:
#import "FirstViewController.h"
@interface FirstViewController ()
@end
@implementation FirstViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.navigationBar.prefersLargeTitles = TRUE;
}
-(IBAction)collapse:(id)sender {
self.navigationController.navigationBar.prefersLargeTitles = FALSE;
self.navigationController.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
}
-(IBAction)expand:(id)sender {
self.navigationController.navigationBar.prefersLargeTitles = TRUE;
self.navigationController.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAlways;
}
@end
How i can collapse and expand the UINavigationbar programmatically ?
self.navigationController.navigationBar.prefersLargeTitles = YES;
– Rodrigo Morbach Feb 11 at 17:43