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!沒有隱藏的按鈕!請幫忙。