Ios 我如何消除视图相互重叠的通知?
我有一个按钮可以切换到另一个视图,因此没有任何代码或操作连接到该按钮。所有操作都是使用故事板完成的,但在prepareForSegue中 我添加了一个检查,以防某个特定值为NULL,并且该检查按预期工作,但我在运行时收到此警告Ios 我如何消除视图相互重叠的通知?,ios,objective-c,uistoryboardsegue,Ios,Objective C,Uistoryboardsegue,我有一个按钮可以切换到另一个视图,因此没有任何代码或操作连接到该按钮。所有操作都是使用故事板完成的,但在prepareForSegue中 我添加了一个检查,以防某个特定值为NULL,并且该检查按预期工作,但我在运行时收到此警告 2017-04-16 14:50:03.653 NWMobileTill[34117:830763] Warning: Attempt to present <TenderListView: 0x7ff81870b280> on <Transactio
2017-04-16 14:50:03.653 NWMobileTill[34117:830763] Warning: Attempt to present <TenderListView: 0x7ff81870b280> on <TransactionListView: 0x7ff818738530> which is already presenting <UIAlertController: 0x7ff81864fff0>
不能在PrepareForsgue中显示视图控制器,如UIAlertController。此时segue已提交,您无法更改视图演示文稿
为了执行验证,显示警报并可能取消导航,您应该实现shouldPerformSegueWithIdentifier当该值为空时,您该怎么办?你能展示一下你的prepareForSegue吗?我编辑并添加了那段代码,尽管它发出了警告,但效果很好,我看到之前调用过它,我可以返回“否”或“是”,但它不接受segue作为输入,我需要提供的NSString标识符是什么?我有点困惑,在使用该标识符时,如何知道发生了哪个segue?您可以通过在故事板中选择segue来分配标识符。是的,我知道了,只是命名让我有点困惑,如果[identifier IsequalString:@TrlistViewToDenderList]起作用的话。
if ([[segue identifier] isEqualToString:@"trListViewToTenderList"]) {
if([NWTillHelper getCurrentOrderNumber] == nil) {
//Step 1: Create a UIAlertController
UIAlertController *userInfoCheck = [UIAlertController alertControllerWithTitle:@"Tender"
message: @"No active transaction, you need to have an active transaction before you can add tenders!"
preferredStyle:UIAlertControllerStyleAlert];
//Step 2: Create a UIAlertAction that can be added to the alert
UIAlertAction* ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[userInfoCheck dismissViewControllerAnimated:YES completion:nil];
}];
//Step 3: Add the UIAlertAction ok that we just created to our AlertController
[userInfoCheck addAction: ok];
//Step 4: Present the alert to the user
[self presentViewController:userInfoCheck animated:YES completion:nil];
return;
}
TenderListView *destViewController = segue.destinationViewController;
destViewController.tenderListViewAmountToPayStr = _transactionListViewUberTotalSumLbl.text;
}