Domanda

I am working on iOS application and i have used the split view like structure which Facebook application has.

I have used the code which has the CLViewController, This code i have found from google.

All working fine but in my current application when the app loads the first screen itself shows the split view in which 80% screen shows the menu and 20% shows the detail page. I want to change it in a way the Facebook app works. In Facebook on loading app directly shows the news feed. so same way i want to load detail page first.

If anyone have any idea how can i achieve it please share.

Thanks in advance.

È stato utile?

Soluzione

Code : How to use SWRevealViewController

Here first initialize your View controllers

FirstViewController * first = [[FirstViewController alloc]init];
SecondViewController * second = [[SecondViewController alloc]init];

Create BarButton....

UIBarButtonItem *revealButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon"] style:UIBarButtonItemStylePlain target:_revealVC action:@selector(revealToggleAnimated:)];

Put firstViewController and secondViewController into Navigation First hide self.navigationbar self.navigationController.navigationBarHidden = YES;

UINavigationController * navigationController1 = [[UINavigationController alloc] initWithRootViewController:first];
navigationController.navigationBar.topItem.leftBarButtonItem = revealButton


UINavigationController * navigationController2 = [[UINavigationController alloc] initWithRootViewController:second];
navigationController.navigationBar.topItem.leftBarButtonItem = revealButton

Initialize SWRevealViewController

_revealVC= [[SWRevealViewController alloc]initWithRearViewController:navigationController1 frontViewController:navigationController2];

_revealVC.rightViewController =nil;

_revealVC.rearViewRevealWidth = 60;
_revealVC.rearViewRevealOverdraw = 0;

_revealVC.bounceBackOnOverdraw = YES;
_revealVC.stableDragOnOverdraw = YES;

_revealVC.rightViewRevealWidth = 350;
_revealVC.rightViewRevealOverdraw = 0;

[_revealVC setFrontViewPosition:FrontViewPositionRight];

[_revealVC revealToggleAnimated:YES];

[self.navigationController setViewControllers:[NSArray arrayWithObject:_revealVC] animated:true];

Hope it will help you

Altri suggerimenti

Here you will get Split View you are looking for Click Here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top