无法从超级视图中删除我的视图

时间:2012-02-06 08:44:00

标签: objective-c ios

在我目前的iOS应用程序中,我正在改变我在欢迎/登录/标签栏视图之间处理切换的方式,因此它使用MainViewController(如本文详述:http://www.mikeziray.com/2010/01/27/handling-your-initial-view-controllers-for-iphone/comment-page-1/#comment-605

我的MainViewController是一个Singleton,包含一堆欢迎/登录/ tabbar视图,它还有以下方法:
     - 从堆栈中删除欢迎视图
     - 从堆栈中删除登录视图

当应用程序启动时,会显示欢迎视图,当它完成检查服务器上的内容时,我会将其删除(调用MainViewcontroller的removeWelcomeView)。

虽然我面对一件奇怪的事 WelcomeViewController具有以下方法从堆栈中删除视图(在MainViewController中调用相应的方法):

- (void)removeView{
   [[MainViewController getInstance] removeWelcomeView];
} 

但以下调用不起作用:

[self removeView]

此调用有效:

[NSTimer scheduledTimerWithTimeInterval:1.0
                                         target:self
                                       selector:@selector(removeView)
                                       userInfo:nil
                                        repeats:NO];

对这个问题有什么想法吗?

注意:MainViewController中的方法如下:

- (void)removeWelcomeView
{
    [welcome.view removeFromSuperview];
}

0 个答案:

没有答案
相关问题