0

我有 ipad 应用程序,一旦加载 LoginViewController 并且用户按下登录按钮,我想在其中添加 splitViewController 然后以下通知起作用,但是通过添加以下代码会发生什么,它会关闭应用程序并再次打开然后显示。

 -(void)actionNotificationData:(NSNotification *)notification {

 [self.loginViewController removeFromSuperview];


UIWindow* window = [UIApplication sharedApplication].keyWindow;
if (!window) 
    window = [[UIApplication sharedApplication].windows objectAtIndex:0];
[[[window subviews] objectAtIndex:0] addSubview:splitViewController];  

 }
4

1 回答 1

2
 [self.loginViewController removeFromSuperview];

removeFromSuperview期待一个UIView's子类,而您正在传递一个UIViewController.

于 2013-07-18T08:37:31.920 回答