介紹:
解決iOS 7中短時間內(nèi)連續(xù)push或者pop view動畫操作而產(chǎn)生崩潰的bug。
bug描述原因為 Can't add self as subview??梢杂孟旅孢@段代碼重現(xiàn)這個bug:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIViewController *vc = [[UIViewController alloc] init
測試環(huán)境:
測試環(huán)境:Xcode 5.0, iOS 7.0 以上。
效果圖:
使用方法:
解決iOS 7中短時間內(nèi)連續(xù)push或者pop view動畫操作而產(chǎn)生崩潰的bug。
bug描述原因為 Can't add self as subview??梢杂孟旅孢@段代碼重現(xiàn)這個bug:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIViewController *vc = [[UIViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
將會得到以下錯誤:
2014-07-03 11:54:25.051 Demo[2840:60b] nested push animation can result in corrupted navigation bar 2014-07-03 11:54:25.406 Demo[2840:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.