How to navigate from one view controller to another view controller on button click?

前端 未结 7 2144
遥遥无期
遥遥无期 2021-01-04 13:48

I am new to iOS Application development, please help me how can I go from one view controller to another view controller on button click?

7条回答
  •  猫巷女王i
    2021-01-04 14:06

    Follow the below step,let the button selector is

    [button addTarget:select action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside]; and implement the selector as

    -(void)buttonClick{
    UIViewController *controler = [[UIViewController alloc] init];
    [self.navigationController pushViewController:controler animated:YES];}
    

    and also make sure viewController has NavigationController embedded within it and replace UIViewController with the Controller you wish to push.

提交回复
热议问题