2013-07-06 293 views
0

我正在使用開源類來滑動視圖。幻燈片功能在應用程序啓動時工作正常,但當我更改視圖或調用segue方法,然後回到HomeViewController時,幻燈片功能停止工作。它僅在HomeVC首次啓動時起作用。請在這裏幫助我。用我的根控制器初始化控制器

AppDelegate.m文件:

didFinishLaunchingWithOptions方法如下:

UIStoryboard *storybrd = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
HomeViewController *controller = [storybrd instantiateViewControllerWithIdentifier:@"ViewController2"]; 

// setup slide navigation view controller instance 
MWFSlideNavigationViewController * slideNavCtl = [[MWFSlideNavigationViewController alloc] initWithRootViewController:controller];  
// slideNavCtl.panEnabled = YES; 

self.window.rootViewController = slideNavCtl; 
[self.window makeKeyAndVisible]; 
return YES; 

didSelectRowAtIndexPath方法如下:

- (無效)的tableView:(UITableView的*)的tableView didSelectRowAtIndexPath方法: (NSIndexPath *)indexPath {

if(tableView == self.tableView1) 
{ 




[self performSegueWithIdentifier: @"CommVC" 
          sender: self]; 
}} 

prepareForSegue方法如下:

- (空)prepareForSegue:(UIStoryboardSegue *)賽格瑞發件人:(ID)發送{

CoViewController *destination = 
    [segue destinationViewController]; 


    destination.name = _name; 

}; 

回答

0

也許當你改變viewController你做了modalPresentation而不是做push。所以基本上幻燈片不起作用,因爲它不再有navigationController作爲rootviewController

當你改變視圖時,請顯示你在那裏做什麼。

+0

是的,我正在做一個modalPresentation。我會嘗試使用推式 –

+0

我們不能在viewDidLoad方法中以rootviewController方式分配navigationController嗎? –

+0

地方從誰改變視圖 – soryngod

相關問題