-(void)loginPerform
{
NSLog(@"start to perform segue!");
[self performSegueWithIdentifier:@"SecondPage" sender:self];
NSLog(@"end perform login!");
}
loginPerform函数在回调函数中调用,并且两个日志都可以打印,因此performSegueWithIdentifier会执行。但当前视图不会更改。performSegueWithIdentifier不起作用回调函数?
- view A和view B由Custom Segue关联。
- 视图嵌入导航控制器。
顺便说一句:我把测试按钮直接执行segue,它的工作原理。 当loginPerform函数被调用时,下一个视图总是查看A时点击测试按钮。
我不明白whatnd.anybody可以帮助我吗?
int user_account_delegate(int reqid, char* msg)
{
NSLog(@"DEBUG: login return %s", msg);
int reterr = 0;
if(reqid!=[BLSInstLink getLoginID])
return -1;
/* parse the login result (JSON) */
if(get_json_object_value(msg, KEY_ERROR, VAL_INTEGER, (void*)&reterr)==0)
{
if(reterr==0)
{
NSLog(@"DEBUG: login succeed.");
[BLSInstLink setLogined:YES];
BLSViewController *this = THIS;
[this loginPerform];
}
else
{
NSLog(@"DEBUG: login failed. err=%d", reterr);
[BLSInstLink setLogined:NO];
[BLSInstLink setErrorCode:reterr];
}
}
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_LOGINRESULT object:nil];
return 0;
}
这是我在自己的UIViewController中实现的回调函数。
-(void)loginPerform{
NSLog(@"in loginPerform");//1
[self dismissViewControllerAnimated:YES completion:^() {
NSLog(@"start perform page2");//2
[self performSegueWithIdentifier:@"SecondPage" sender:self];
NSLog(@"end perform page2");//3
}];
}
这是称为在回调function.Just 1个打印
- (IBAction)test_click:(id)sender {
[self performSegueWithIdentifier:@"SecondPage" sender:self];
}
这是一个测试按钮,测试执行赛格瑞的执行功能。它运作良好。
你在写什么类的代码。 UIViewController子类?你能否用更多的代码来阐述你的问题。 – Divyu
检查您的segue标识符名称。它是一样的吗? – Rox
调用的回调是什么线程? – Wain