往navigation上边添加自定义控件
[self.navigationItem setTitleView:btn];
iOS如何让主界面不显示NavigationBar
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:animated];
}
注意,animated设为YES,仍是会有一个瞬间的过渡效果。只有设置为animated才能真正实现。
2、
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.navigationController setNavigationBarHidden:NO animated:YES];
3、
self.navigationController.navigationBarHidden = YES;用来隐藏;
self.navigationController.navigationBarHidden = NO;用来显示
4、
[[[self.navigationController.navigationBar subviews] objectAtIndex:0] setAlpha:0];//设为透明
忘记尺寸,iOS如何获取某些控件大小,如statusbar或者navigationbar
// 状态栏(statusbar)
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
NSLog(@"status width - %f", rectStatus.size.width); // 宽度
NSLog(@"status height - %f", rectStatus.size.height); // 高度
// 导航栏(navigationbar)
CGRect rectNav = self.navigationController.navigationBar.frame;
NSLog(@"nav width - %f", rectNav.size.width); // 宽度
NSLog(@"nav height - %f", rectNav.size.height); // 高度
为什么AFN执行后不进入block直接跳出
必须要对manage进行懒加载
iOS控件之UISegmentedControl
iOS 关于navigationBar的一些:毛玻璃、透明、动态缩放、动态隐藏
网友评论