我有一个基于 block 的网络函数,我只想在它成功时允许一个 segue 开始。这是一次身份验证尝试:
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
NSLog(@"in process");
if (!error) {
NSLog(@"succcess");
}else{
NSLog(@"failure");
}
}];
如何在 viewController 中使用此语句有条件地开始 segue?
最佳答案
[self performSegueWithIdentifier@"YourSegueIdentifierThatYouSetInStoryboard"];
如果我正确理解问题,应该可以解决问题。
编辑 1:
要在主线程上触发此代码,请像这样包装您的代码:
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier@"YourSegueIdentifierThatYouSetInStoryboard"];
});
关于ios - 如何在 iOS 中基于基于 block 的网络操作有条件地触发 segue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21489488/