0
我有以下情况,我想在Autolay中设置一个按钮为隐藏状态。如何确保viewWillLayoutSubviews/All View Calls已完成?
所以基本上说这个方法叫做- (void) hideSomeButton
。我称这种方法为:
BlahViewController *bVC = [[UIStoryboard storyboardWithName:"Blah"] instantiateInitialViewController];
[self.navigationController pushViewController:bVC animated:YES];
[bVC hideSomeButton];
我假定这是方法调用应该是什么:
1. init Method
2. viewDidLoad
3. viewWillAppear
4. viewWillLayoutSubviews (This has an explicit call making someButton.hidden = NO)
5. viewDidLayoutSubviews
6. hideSomeButton (This has an explicit call making someButton.hidden = NO)
然而,`viewWillLayoutSubviews'被调用了两次。因此,发生的情况是:
1. viewWillLayoutSubviews - Button Shown
2. hideSomeButton - Button Hidden
3. viewWillLayoutSubviews - Button Shown
BOOM!没有隐藏的按钮!请帮忙。