iOS 导航栏技巧

1.当使用自定义的左侧导航栏的按钮的时候,左滑返回手势失效:

self.navigationController.interactivePopGestureRecognizer.delegate = self;

2.导航条的穿透效果:可用于用户界面

//导航的穿透效果
/**
 *   NSArray *array =  [[self.navigationController.navigationBar subviews] 
 nslog:
 "<_UINavigationBarBackground: 0x7fe6b151fcb0; frame = (0 -20; 414 64); alpha = 0.5; opaque = NO; autoresize = W; userInteractionEnabled = NO; layer = >",
 "<_UINavigationBarBackIndicatorView: 0x7fe6b15246f0; frame = (0 11.6667; 13 21); alpha = 0; opaque = NO; userInteractionEnabled = NO; layer = >"
 )
 */
[[self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 0.5;
//下面这句话是无法形成穿透效果,是导航的透明度变为0 的
self.navigationController.navigationBar.alpha = 0.01;

3.设置导航条的图片

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"屏幕快照 2016-08-16 下午4.59.25"] forBarMetrics:UIBarMetricsDefault];

你可能感兴趣的:(iOS 导航栏技巧)