Revert to previous controller after xx amount of seconds

后端 未结 1 1010
心在旅途
心在旅途 2021-01-28 19:45

I have a very simple app with very little code. In my ViewController I have done no code, I have only added a navigation bar which contains a next button with a modal to the Vid

1条回答
  •  有刺的猬
    2021-01-28 20:28

    try this code

    - (void)viewDidLoad
      {
        [super viewDidLoad];
        //code added
        //[self performSelector:@selector(goBack) withObject:nil afterDelay:5.0];
        [NSTimer scheduledTimerWithTimeInterval:3.0
                               target:self
                               selector:@selector(goBack)
                               userInfo:nil repeats:NO];
    
    }
    
     //code added
     -(void)goBack{
         [self.navigationController popViewControllerAnimated:YES];
     }
    

    0 讨论(0)
提交回复
热议问题