2012-12-26 47 views
0

當按下一排表視圖時我想在我的故事板的另一個屏幕中移動。從tableview移動到故事板的另一個uiviewcontroller

1)我不想使用導航控制器,還是我必須?

所以,我想這個代碼:內

UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 

UIViewController *vc=[storyBoard instantiateViewControllerWithIdentifier:@"CenterMain"]; 
    [vc setModalPresentationStyle:UIModalPresentationFullScreen]; 
    [self presentedViewController:vc animated:YES]; 

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

我得到這樣的警告:在運行時

Instance method '-presentedViewController:animated:' not found (return type defaults to 'id') 

與此錯誤:

MainMap presentedViewController:animated:]: unrecognized selector sent to instance 0x72a2070 
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainMap presentedViewController:animated:]: unrecognized selector sent to instance 0x72a2070' 

2)如果使用navigationController與此代碼:

UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
[[self navigationController] pushViewController:[storyBoard instantiateViewControllerWithIdentifier:@"CenterMain"] animated:YES]; 

它的工作原理,但問題是我不希望看到在頂部導航控制器的吧。

所以我想無論是用1〜HELO,或者告訴如何刪除頂欄的​​sollution 2

謝謝!

回答

1

使用UIViewController- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated- (void)setNavigationBarHidden:(BOOL)hidden;方法。所以你的情況,

[[self navigationController] setNavigationBarHidden:YES]; 

如果你只想隱藏它,或:

[[self navigationController] setNavigationBarHidden:YES animated:YES]; 

,如果你想同時隱藏動畫。

+0

謝謝! thas比試圖刪除我的導航控制器更容易。 – ghostrider

相關問題