【发布时间】:2014-10-27 21:47:40
【问题描述】:
我有以下情况,我想在自动布局中设置按钮后将其设置为隐藏。
所以基本上,假设这个方法称为- (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
轰!没有隐藏按钮!请帮忙。
【问题讨论】:
标签: ios uibutton viewwillappear