关于viewDidLoad里调用presentModalViewController的问题

原贴地址:http://www.cocoachina.com/bbs/read.php?tid=97273

------------------------------------------------------------------------------------------------------------------------------------------------------
- (void)viewDidLoad 里调用presentModalViewController无效果,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions里调用presentModalViewController就有效果

加个button,在button点击事件里调用presentModalViewController也没有问题

表示非常迷惑,为什么- (void)viewDidLoad 里调用presentModalViewController就没有效果呢。
明眼的大神帮忙解释下吧- -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

在(void)viewDidAppear:(BOOL)animated里面调用吧

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

最后分享一个利用presentModalViewController方法制作的启动动画吧,大神见笑了

    - (void)viewDidAppear:(BOOL)animated{
        [loginViewController presentModalViewController:welcomeViewController animated:NO];
        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(dismissModalView) userInfo:nil repeats:NO];
    }
    - (void)viewDidLoad {
        [super viewDidLoad];
        loginViewController = [[UIViewController alloc] init];
        loginViewController.view.frame = [[UIScreen mainScreen] bounds];
        loginViewController.view.backgroundColor = [UIColor redColor];
        [self.view addSubview:loginViewController.view];
       
        welcomeViewController = [[UIViewController alloc] init];
        welcomeViewController.view.frame = [[UIScreen mainScreen] bounds];
        UIImageView *welcomeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]];
        welcomeImageView.frame = CGRectMake(0, 0, 320, 460);
        [welcomeViewController.view addSubview:welcomeImageView];
    }
    - (void)dismissModalView{
        welcomeViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [welcomeViewController dismissModalViewControllerAnimated:YES];
    }
资源地址:http://download.csdn.net/detail/liyan5953wow/4162557


阅读更多
文章标签: application button
个人分类: 开发日志
上一篇标签栏+导航栏的交互使用详细步骤
下一篇WEPopover的使用
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭