我正在嘗試使自定義登錄視圖彈出式視圖像一個警報視圖。我使用以下函數模擬了alertview彈出窗口。此功能在viewDidLoad中發現礦井loginViewController.m自定義登錄視圖彈出式警報視圖
-(void)initialDelayEnded {
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
self.view.alpha = 1.0;
[UIView animateWithDuration:1.0/1.5 animations:^{
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
}completion:^(BOOL complete){
[UIView animateWithDuration:1.0/2 animations:^{
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
}completion:^(BOOL complete){
[UIView animateWithDuration:1.0/2 animations:^{
self.view.transform = CGAffineTransformIdentity;
}];
}];
}];
}
- (void)viewDidLoad
{
[self initialDelayEnded];
[super viewDidLoad];
}
而且我在我的firstViewController我以下列方式loginViewController調用。
LoginViewController *login = [[LoginViewController alloc]initWithNibName:@"LoginViewController" bundle:NULL];
[self presentViewController:login animated:YES completion:NULL];
但它崩潰,出現以下錯誤。
'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UIView: 0x8674bf0; frame = (0 20; 320 460); autoresize = W+H; layer = <CALayer: 0x8670620>> is associated with <LoginViewController: 0x868a7d0>. Clear this association before associating this view with <LoginViewController: 0x8451e70>.
有人可以幫我嗎?
在此先感謝!
可能是'[super viewDidLoad]'應該先行嗎? – anticyclope
沒有仍然收到相同的錯誤。 – Steaphann