[英]performSegueWithIdentifier doesn't show new view
I'm having an issue with my performSegueWithIdentifier, because he fires and when I get a breakpoint on the viewDidLoad of the NextViewController he enters and executes fine. 我的performSegueWithIdentifier出现问题,因为他会触发,并且当我在NextViewController的viewDidLoad上遇到断点时,他可以输入并执行正常。 Problem is there is no output and the screen continues to show the CurrentViewController. 问题是没有输出,并且屏幕继续显示CurrentViewController。 What can be the error ? 可能是什么错误?
(CurrentViewController is a TableViewController) (CurrentViewController是一个TableViewController)
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
_selected = [self.evlist objectAtIndex:indexPath.row];
[self performSegueWithIdentifier:@"eventlist" sender:self];
return indexPath;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSString * event_id = [_selected objectForKey:@"id"];
NSString * event_name = [_selected objectForKey:@"label"];
[segue.destinationViewController setEvent_id:event_id];
[segue.destinationViewController setEvent_id:event_id];
[segue.destinationViewController setEvent_name:event_name];
}
(NextViewController is a ViewController) (NextViewController是一个ViewController)
- (void)viewDidLoad
{
[super viewDidLoad];
_evname_label.text = _event_name;
_evid_label.text = _event_id;
NSLog(@"This is strange %@",_event_name);
}
He logs everything as expected... the view doesn't show! 他按预期方式记录了所有内容……该视图未显示!
Your code appears correct. 您的代码显示正确。 Are you sure the segue is configured correctly? 您确定安全配置正确吗? Check the Style
, Presentation
and Transition
styles. 检查Style
, Presentation
和Transition
样式。
Sorry but I had a bug in my coding... I was calling the prepareforsegue inside a for cycle and the problem was somewhere around it. 抱歉,但是我的编码中有一个错误……我在for循环内调用prepareforsegue,而问题出在它周围。 Prepareforsegue outside for and it was cool :) Thanks all 在外面准备,很酷:)谢谢大家
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.