- (void)viewDidLoad { [super viewDidLoad]; if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) { self.edgesForExtendedLayout = UIRectEdgeNone; self.navigationController.navigationBar.translucent=YES; } // Do any additional setup after loading the view. }
我不希望我的scrollView默认位于navigationBar的后面.所以我设置了self.edgesForExtendedLayout = UIRectEdgeNone;.
那个viewDidLoad是我所有viewController的母viewDidLoad.
没关系.但我喜欢半透明的效果.
当我将self.edgesForExtendedLayout设置为none时,似乎半透明效果消失了.
如何将其设置为无,仍然具有半透明效果.
我认为一个好的解决方案是安排scrollview的插图.
我做到了
- (void)viewDidLoad { [super viewDidLoad]; if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) { //self.edgesForExtendedLayout = UIRectEdgeNone; self.navigationController.navigationBar.translucent=YES; self.automaticallyAdjustsScrollViewInsets = YES; } // Do any additional setup after loading the view. }
这就是我得到的: