How can I move to another view controller when the user clicks on a row?

前端 未结 9 1307
梦如初夏
梦如初夏 2020-12-21 17:41

I am new to iPhone development, and I want to move to another page when the user clicks on a particular row. So, if they click on first row, I want the page to redirect to t

9条回答
  •  旧巷少年郎
    2020-12-21 18:30

     NSInteger row = indexPath.row;
    
    
    
    UIViewController *newFrontController = nil;
    
     if (row == 0)
        {
            YourViewController *yourViewController = [[YourViewController alloc] initWithNibName:@"YourViewController" bundle:nil];
            newFrontController = [[UINavigationController alloc] initWithRootViewController:peopleViewController];
            [self.navigationController setNavigationBarHidden:YES];
        }  else if(row == 1){
    //do your code
    }
    

    do this in didSelectRowAtIndexPath in tableView.

提交回复
热议问题