所有你需要做的菜单项目的创建表,每个项目都有标识符
在每个项目中单击右键,选择显示视图控制器
那一切
#import "SlIDeMenu.h" #import "SWRevealVIEwController.h" @interface SlIDeMenu () @end @implementation SlIDeMenu{ NSArray *menu_items; NSArray*thumbIEs; NSArray*indentifer; } - (ID)initWithStyle:(UItableVIEwStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (voID)vIEwDIDLoad { [super vIEwDIDLoad]; indentifer = @[@"report_vIEw",@"ann_vIEw",@"message_vIEw",@"calendar_vIEw",@"schedule_vIEw",@"about_vIEw",@"student_vIEw" ]; menu_items = @[@"Reports",@"Messages",@"Announcement",@"Calendar",@"Schedule",@"About us",@"back to Students"]; thumbIEs = @[@"report.png",@"message.jpg",@"ann.jpg",@"calendar.jpg",@"schedule.png",@"about.png" ]; } - (voID)dIDReceiveMemoryWarning { [super dIDReceiveMemoryWarning]; // dispose of any resources that can be recreated. } #pragma mark - table vIEw data source - (NSInteger)numberOfSectionsIntableVIEw:(UItableVIEw *)tableVIEw { // Return the number of sections. return 1; } - (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [menu_items count]; } - (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath { Nsstring * cell_IDentifer = [indentifer objectAtIndex:indexPath.row]; UItableVIEwCell *cell = [tableVIEw dequeueReusableCellWithIDentifIEr:cell_IDentifer forIndexPath:indexPath]; if (cell== nil) { cell = [[UItableVIEwCell alloc]initWithStyle:UItableVIEwCellStyleDefault reuseIDentifIEr:cell_IDentifer]; } //cell.textLabel.text = [menu_items objectAtIndex:indexPath.row]; //cell.imageVIEw.image = [UIImage imagenamed:[thumbIEs objectAtIndex:indexPath.row] ]; return cell; } #pragma mark - Navigation // In a storyboard-based application,you will often want to do a little preparation before navigation - (voID)prepareForSegue:(UIStoryboardSegue *)segue sender:(ID)sender { if ([segue isKindOfClass:[SWRevealVIEwControllerSegue class]]) { SWRevealVIEwControllerSegue *swsegue = (SWRevealVIEwControllerSegue*)segue; swsegue.performBlock = ^(SWRevealVIEwControllerSegue *rvc_segue,UIVIEwController * svc,UIVIEwController *dvc){ UINavigationController *navController = (UINavigationController *)self.revealVIEwController.frontVIEwController; [navController setVIEwControllers:@[dvc] animated:NO]; [self.revealVIEwController setFrontVIEwposition:FrontVIEwpositionleft animated:YES]; }; } } @end
更新XCODE 6.4的答案
完整的例子
创建vIEwController来保存SWRevealVIEwController类
此视图有后面(幻灯片菜单项),前面(已实现的项目)
请检查屏幕截图
从幻灯片菜单vIEwController类到每个项目
这个表视图实现我的幻灯片菜单项,我用的是push方法
(SWRevealVIEwControllerSeguePushController)
这是导航控制器之前的连接检查器
希望这能回答你所有的考验
总结以上是内存溢出为你收集整理的如何在ios中使用SWRevealViewcontroller导航到sw_front视图?全部内容,希望文章能够帮你解决如何在ios中使用SWRevealViewcontroller导航到sw_front视图?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)