Objective c NStimer后新建屏幕

Objective c NStimer后新建屏幕,objective-c,Objective C,是否有方法在NStimer在0上后打开新屏幕 e、 x: -(void)randomMainVoid{ 如果(mainit如果您使用的是标准视图控制器/nib模型,加载新屏幕非常容易。但是,如何显示它实际上取决于您的应用程序。但是,作为一个示例,如果您希望在计时器完成后显示新的模式屏幕,并且您有一个名为AfterTimerViewController的视图控制器类h一个相关的nib文件,您可以将其显示为: -(void) randomMainVoid { if (mainInt <=

是否有方法在NStimer在0上后打开新屏幕

e、 x:

-(void)randomMainVoid{

如果(mainit如果您使用的是标准视图控制器/nib模型,加载新屏幕非常容易。但是,如何显示它实际上取决于您的应用程序。但是,作为一个示例,如果您希望在计时器完成后显示新的模式屏幕,并且您有一个名为
AfterTimerViewController
的视图控制器类h一个相关的nib文件,您可以将其显示为:

-(void) randomMainVoid
{
  if (mainInt <= 0) {
    [randomMain invalidate];

    // This assumes this method is defined in the current view
    // controller. If not, replace self with the appropriate reference
    AfterTimerViewController* controller = [[AfterTimerViewController alloc] initWithNibName:@"AfterTimerViewController" bundle:nil];
    // Uncomment and use for pushing onto a navigation controller's stack
    [[self navigationController] pushViewController:controller animated:YES];

    // Uncomment and use if you want the new view controller to replace the root of your
    // current navigation controller stack
    //[[self navigationController] setViewControllers:[NSArray arrayWithObject:controller] animated:YES];

    // Uncomment and use for presenting the new controller as a modal view controller
    //[self presentModalViewController:controller animated:YES];

    [controller release]; // change this if you're using ARC or taking ownership of this controller accordingly
  } else {
    //something
  }
}
-(void)randomMainVoid
{

如果(mainInt@Nathan请阅读我链接的评论和指南。如果您使用的是导航控制器,那么您会将新视图推送到导航控制器的堆栈上,而不是以模式显示。不过,您没有在问题中提供有关UI设置方式的任何信息。我将编辑我的答案以推送控制器而不是以模态的方式呈现。
-(void) randomMainVoid
{
  if (mainInt <= 0) {
    [randomMain invalidate];

    // This assumes this method is defined in the current view
    // controller. If not, replace self with the appropriate reference
    AfterTimerViewController* controller = [[AfterTimerViewController alloc] initWithNibName:@"AfterTimerViewController" bundle:nil];
    // Uncomment and use for pushing onto a navigation controller's stack
    [[self navigationController] pushViewController:controller animated:YES];

    // Uncomment and use if you want the new view controller to replace the root of your
    // current navigation controller stack
    //[[self navigationController] setViewControllers:[NSArray arrayWithObject:controller] animated:YES];

    // Uncomment and use for presenting the new controller as a modal view controller
    //[self presentModalViewController:controller animated:YES];

    [controller release]; // change this if you're using ARC or taking ownership of this controller accordingly
  } else {
    //something
  }
}