我是iOS开发新手,目前一直在创建后退按钮。我已经将popViewControllerAnimated方法放在敲击按钮上,我也在调试模式下测试它,并且后退按钮方法正在调用,但popViewControllerAnimated不起作用。后退按钮没有响应?
这是代码。
- (void)viewDidLoad
{
[super viewDidLoad];
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake((self.view.frame.size.height-100), 30, 80, 20)];
[backButton setTitle:@"Back" forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(BackButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:backButton];
//some piece of code...
}//end of viewDidLoad method
-(void)BackButtonClicked: (id)sender{
[self.navigationController popViewControllerAnimated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"testing" message:@"some message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:@"NO", nil];
[alert show];
}
在点击返回按钮时显示此警报,但屏幕不回退。
有关此问题的任何帮助将非常可观。
我在我以前的viewController编写这些代码叫这个的viewController
PlaceTranslatedDetailsViewController *secondViewController =
[self.storyboard instantiateViewControllerWithIdentifier:@"placeTranslatedDetail"];
[self presentViewController:secondViewController animated:YES completion:NULL];
然而,这种的viewController和以前的viewController设计编程
你的视图控制器推送什么?它是如何加载和呈现的? – pdrcabrod
编写本代码的视图控制器 – iPatel
请现在审查,我对我的问题的内容做了一些更改 –