美文网首页
ipad开发

ipad开发

作者: Willism | 来源:发表于2017-07-13 11:53 被阅读0次
设备选择为: ipad



AppDelegate.h
AppDelegate.m

RootableviewController.m

#import "RooTableViewCotntroller.h"

#import "AppDelegate.h"

#import "DetailViewController.h"

@interface RooTableViewCotntroller ()

@property(nonatomic,strong)NSArray* imgTitleArr;

@property(nonatomic,strong)NSArray* imgArr;

@end

@implementation RooTableViewCotntroller

- (void)viewDidLoad {

[super viewDidLoad];

self.imgTitleArr = @[@"**",@"**",@"**",@"**",@"**",@"**",@"**"];

NSMutableArray* arr = [[NSMutableArray alloc]init];

for (int i = 1; i <= 7; i++)

{

NSString *imgName = [NSString stringWithFormat:@"car%d.jpg",i];

UIImage* img = [UIImage imageNamed:imgName];

[arr addObject:img];

}

self.imgArr = [arr copy];

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return 1;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return self.imgArr.count;

}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

static NSString *identifier = @"cell";

UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:identifier];

if (cell == nil)

{

cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];

}

cell.textLabel.text = self.imgTitleArr[indexPath.row];

return  cell;

}

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

{

AppDelegate* appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;

DetailViewController *detaiVC = appDelegate.detailVC;

detaiVC.mapView.image = self.imgArr[indexPath.row];

}


DetailViewController.h

DetailViewController.m

#import "DetailViewController.h"

#import "AppDelegate.h"

#import "RooTableViewCotntroller.h"

@interface DetailViewController ()<UIPopoverControllerDelegate>

@end

@implementation DetailViewController

- (void)viewDidLoad {

[super viewDidLoad];

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"主菜单" style:UIBarButtonItemStylePlain target:self action:@selector(click:)];

AppDelegate* app = (AppDelegate*)[UIApplication sharedApplication].delegate;

app.spiltVC.displayModeButtonItem.title = @"显示导航栏";

self.navigationItem.leftBarButtonItem  = app.spiltVC.displayModeButtonItem;

}

-(void)click:(UIBarButtonItem* )sender

{

RooTableViewCotntroller* rootVC = [[RooTableViewCotntroller alloc]initWithStyle:UITableViewStylePlain];

UIPopoverController* popCtl = [[UIPopoverController alloc]initWithContentViewController:rootVC];

popCtl.popoverContentSize = CGSizeMake(200, 300);

popCtl.backgroundColor = [UIColor yellowColor];

popCtl.delegate = self;

[popCtl presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}

-(BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController

{

return YES;

}

-(void)splitViewController:(UISplitViewController *)svc willChangeToDisplayMode:(UISplitViewControllerDisplayMode)displayMode

{

// 左侧导航栏隐藏

if (displayMode == UISplitViewControllerDisplayModePrimaryHidden)

{

NSLog(@"左侧导航将要隐藏");

AppDelegate *app = (AppDelegate*)[UIApplication sharedApplication].delegate;

app.spiltVC.displayModeButtonItem.title = @"显示导航栏";

//

svc.displayModeButtonItem.title = @"显示导航栏";

self.navigationItem.leftBarButtonItem = app.spiltVC.displayModeButtonItem;

}

else if (displayMode == UISplitViewControllerDisplayModePrimaryOverlay)

{

NSLog(@"左侧导航覆盖到详情视图上");

}

else if (displayMode == UISplitViewControllerDisplayModeAllVisible)

{

NSLog(@"左侧导航全部显示");

self.navigationItem.leftBarButtonItem = nil;

}

else

{

NSLog(@"自动显示");

}

}


相关文章

  • iOS iPad开发~demo

    iOS iPad开发~demo iOS iPad开发~demo

  • ipad开发

    IPAD 一、iPad开发 1. 了解什么是iPad 2. 掌握iphone与ipad的开发时区别(尺寸、点、排版...

  • ipad开发

    RootableviewController.m #import "RooTableViewCotntroller...

  • 重点 (一) : IPad和IPhone

    iPad开发与iPhone开发的异同简介1. iPad开发与iPhone开发的异同2. QQ空间的分析3. 登录界...

  • 适配iphone和iPad

    一、分别开发iphone和iPad版本二、兼容开发iphone和ipad1、General -> Deployme...

  • iPad开发前的“准备”

    简介: 因为公司最近准备开发iPad版本的项目,之前没开发过,所以找了一些资料,就以下几点来说下开发iPad的项目...

  • iPad开发适配

    在开发过程中,iPad可以自己开发APP,也可以和iOS开发出来一个App,然后根据不同的设备进行不同的适配,那么...

  • IOS开发学习笔记(一)

    概述:iOS是苹果开发的手持设备操作系统(iPhone,iPad,iPod touch,iPad mini)。基于...

  • 让iPhone也能popup的效果

    开发过iPad的同学知道UIPopoverController,这个可是针对iPad的专用API如果使用在iPho...

  • 社区

    CocoaChina 苹果开发中文站 - 最热的iPhone开发社区 最热的苹果开发社区 最热的iPad开发社区 ...

网友评论

      本文标题:ipad开发

      本文链接:https://www.haomeiwen.com/subject/vqyucxtx.html