gpt4 book ai didi

ios - 8.4 上的警报 View 未关闭

转载 作者:行者123 更新时间:2023-11-28 21:40:23 24 4
gpt4 key购买 nike

场景
1)我开始编辑键盘来了。
2)然后我触摸一个按钮
3)在触摸按钮时我添加了AlertView,在添加之前我已经辞去了第一响应者
4)点击 AlertView OK 按钮我弹出 viewController
5)弹出后,keyBoard 会在该屏幕上出现一段时间,然后关闭。
6)它应该在同一个 Controller 上而不是在前一个 Controller 上被解雇

代码-

- (IBAction)cancelSkipButtonTouchUpInside:(id)sender {

[self.textMobileNumber resignFirstResponder];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"Entered number will not be saved" delegate:self cancelButtonTitle:nil otherButtonTitles: @"OK",@"Cancel", nil];
alertView.tag = ktagYourNumberWillNotBeSaved;
[alertView show];
alertView = nil ;

}


- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
case ktagYourNumberWillNotBeSaved:
{
[self.navigationController popToViewController:self animated:YES];
}
}

最佳答案

在这里你添加了 self 这意味着你的导航堆栈调用相同的 ViewController,请尽量避免选择 1 和 2

改变

 [self.navigationController popToViewController:self animated:YES];

进入

   [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];

else 选择 2

 for (UIViewController *vc in self.navigationController.viewControllers) {
if ([vc isKindOfClass:[ViewController2 class]]) // ViewController2 --> call your view controller where you want to pop
{
[self.navigationController popToViewController:vc animated:YES];
}
}

else choice-3

[self.navigationController popViewControllerAnimated:YES]

关于ios - 8.4 上的警报 View 未关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32371269/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com