我試圖更改視圖控制器時按下圖片中的區域。 我試着這樣做:從UIImage更改ViewController
-(void)openDrawer{
UIStoryboard *mStoryBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc =[mStoryBoard instantiateViewControllerWithIdentifier:@"DrawViewController"];
[self.navigationController pushViewController:vc animated:YES];
}
但self.navigationController不存在,這是可以理解的,但我不能找到一種方法,在圖像獲得當前的viewController與
我試圖把它在不同的類中,從當前視圖的viewController進行委派。
-(void) changeChangeViewToName:(NSString *)name{
UIStoryboard *mStoryBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc =[mStoryBoard instantiateViewControllerWithIdentifier:name];
[self.navigationController pushViewController:vc animated:YES];
}
這從viewController裏面工作,但我不能從圖像裏面調用函數。