运行此方法后,我试图在视图上显示它。出于某种原因,每当我尝试在此方法结束时使用以下内容时,它将不会显示:
[self viewWillAppear: YES];
我只是想将所有这些信息传递到viewDidLoad中,以便显示它。
-(void)categoryDining{
//Some method
[self viewWillAppear:YES];
};
编辑:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MapViewController *category1 = [[MapViewController alloc] init];
NSArray *array=[self.navigationController viewControllers];
switch (indexPath.row) {
case 0:
[self.navigationController popToViewController:[array objectAtIndex:[array count]-2] animated:YES];
break;
case 1:
[category1 startOp];
[self.navigationController popToViewController:[array objectAtIndex:[array count]-2] animated:YES];
break;
// etc...
default:
break;
}
然后该方法在另一个viewcontroller中运行:
-(void)startOp{
//Method here
[self viewWillAppear Animated:YES];
}
正如您所见,我将消息发送到viewWillAppear。它不会加载到屏幕上。
答案 0 :(得分:1)
我真的不明白这个问题,但你不应该自己打电话给viewWillAppear:
。它由视图控制器为您调用。相反,您可以实现该方法并在其中执行任何操作:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// do stuff
}