0

[self presentModalViewController:head animated:NO];在 ios 4.3 中使用并寻找 ios 5 及更高版本的替代品。我更喜欢为所有 iOS 版本使用通用的东西,但if (iOS is lower than 6)也可以很好。我的问题是,[self presentViewController:head animated:YES completion:nil];仅当设置为. 知道为什么吗?我不希望它动画。如果我不使用,还有什么可以使用的吗?animatedYESStoryBoards

4

1 回答 1

1

应用程序是否完全失败?你启用了 NSZombies 吗?

如果你正在做这样的事情

- (id)init {
    self = [super init]

    if (self) {
       ViewController * viewController = [[ViewController alloc] init];
       [self presentViewController:viewController animated:YES];
    }

    return self;
}

这是因为视图尚未启动,请使用以下方法之一

- (void)viewDidAppear:(BOOL)animated {
   [super viewDidAppear:animated];

   ViewController * viewController = [[ViewController alloc] init];
   [self presentViewController:viewController animated:YES];

}

// OR

- (void)viewDidLoad {
   [super viewDidLoad];

   ViewController * viewController = [[ViewController alloc] init];
   [self presentViewController:viewController animated:YES];

}

我知道这可能无法回答您的问题,但您没有发布它所在的启动器。但这是一个常见错误,所以我想我会发布它以解决您的问题。

于 2013-02-04T16:13:38.147 回答