Ios 解除ViewControllerAnimated不工作
我正在使用IOS6的故事板。我试图返回到以前的viewcontroller,但它不工作 我在这里定制了我的后扣Ios 解除ViewControllerAnimated不工作,ios,ios6,Ios,Ios6,我正在使用IOS6的故事板。我试图返回到以前的viewcontroller,但它不工作 我在这里定制了我的后扣 UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeCustom]; btnBack.frame = CGRectMake(0, 0, 45,35); [btnBack setTitle:@"Back" forState:UIControlStateNormal]; [btnBack.titleLabel setFont:
UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeCustom];
btnBack.frame = CGRectMake(0, 0, 45,35);
[btnBack setTitle:@"Back" forState:UIControlStateNormal];
[btnBack.titleLabel setFont: [UIFont fontWithName:@"Courier" size:15]];
btnBack.layer.cornerRadius=5.0;
btnBack.layer.borderWidth=2.0;
[btnBack setBackgroundColor:[UIColor colorFbBlue]];
btnBack.layer.borderColor=[UIColor colorFbBlue].CGColor;
[btnBack setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btnBack addTarget:self action:@selector(Click_On_Btn_Back) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithCustomView:btnBack];
-(void)Click_On_Btn_Back{
[self dismissViewControllerAnimated:YES completion:nil];
}
这就是我从上一个视图控制器推送segue的方式
if([segue.identifier isEqualToString:@"segueFbShare"]){
FbShareViewController *fbVC=[segue destinationViewController];
fbVC.imageUrl=self.product.ImageUrl;
}
使用UINavigationController时转到上一个UIViewController:
[self.navigationController popViewControllerAnimated:YES];
在使用导航控制器时,将该行代码放入您的
单击\u Btn\u Back
方法并推送
您需要使用以下方法删除视图:
- (void)Click_On_Btn_Back {
[self.navigationController popViewControllerAnimated:YES];
}
另外,
点击返回
不是通用的iOS命名约定。您应该使用类似的方式:clickOnBtnBack
()。您是否将viewController
作为一个模式显示?您是否正在使用导航辅助滚轮
?非模态。这只是一个推动。我正在使用navigationcontroller。