免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
UISplitViewController类,只有在ipad中才可以使用。同学,在扣丁学堂上课,你还用ipad吗?ipad的屏幕比iphone大,所以在界面上,ipad比iphone多一个UISplitViewController,用来实现ipad在横屏时,分两栏显示所需要的界面,可以一边是目录一边是具体的内容。首先创建一个Row1Detail和RootViewController,其中RootViewController继承UITableViewController。同事创建两个相应的xib文件。AppDelegate 中的代码如下:interface testsplitviewAppDelegate : NSObject UIWindow *window;UISplitViewController *splitView;RootViewController *root;Row1Detail *detail;property (nonatomic, retain) IBOutlet UIWindow *window;property (nonatomic, retain) IBOutlet UISplitViewController *splitView;property (nonatomic,retain) IBOutlet RootViewController *root;property (nonatomic, retain) IBOutlet Row1Detail *detail;end实现类:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions / Override point for customization after app launch.self.window addSubview:splitView.view;self.window makeKeyAndVisible;return YES;修改MainWindow.xib文件:添加UISplitViewController容器绑定的事件如下:RootViewController的代码如下:interface RootViewController : UITableViewController Row1Detail *detail;property (nonatomic,retain) IBOutlet Row1Detail *detail;end实现代码:#import RootViewController.himplementation RootViewControllersynthesize detail;#pragma mark -#pragma mark View lifecycle- (void)viewDidLoad super viewDidLoad;self.clearsSelectionOnViewWillAppear = NO;self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);#pragma mark -#pragma mark Table view data source- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView return 1;- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section return 10;- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath static NSString *CellIdentifier = CellIdentifier;UITableViewCell *cell = tableView dequeueReusableCellWithIdentifier:CellIdentifier;if (cell = nil) cell = UITableViewCell alloc initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier autorelease;cell.accessoryType = UITableViewCellAccessoryNone;cell.textLabel.text = NSString stringWithFormat:Row %d, indexPath.row;return cell;#pragma mark -#pragma mark Table view delegate- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath detail.detailItem = NSString stringWithFormat:Row %d, indexPath.row;Row1Detail的代码interface Row1Detail : UIViewController UILabel *Text1;id detailItem;property (nonatomic,retain) IBOutlet UILabel *Text1;property (nonatomic, retain) id detailItem;-(IBAction) click;end实现代码如下:#import Row1Detail.himplementation Row1Detailsynthesize Text1;synthesize detailItem;-(IBAction) clickNSLog(%,Text1.text);UIAlertView *alert=UIAlertView alloc initWithTitle:标题 message:22 delegate:self cancelButtonTitle:关 otherButtonTitles:nil;alert show;alert release;Text1.text=11111111111;- (void)setDetailItem:(id)newDetailItemif (detailItem != newDetailItem) detailItem release;detailItem = newDetailItem retain;Text1.text = detailItem description;/ Implement viewDidLoad to do additional setup after loading the view, typically from a nib.- (void)viewDidLoadsuper
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 维修硬化道路合同范本
- 绿植种植采购合同范本
- 直播流量推广合同范本
- 酒店内部经营合同范本
- 辽宁篮球投手合同范本
- 社区依托建设合同范本
- 物业配房售卖合同范本
- 烘培设备采购合同范本
- 炉料纯铁销售合同范本
- 邀请学术专家合同协议
- 纯水储罐清洗施工方案
- 北京中医药大学《中医基础理论》期中考试试卷(含答案)
- 油库施工冬季施工方案
- 我国农业数字化技术发展现状与数字经济发展策略
- DB5133∕T 74-2023 甘孜藏餐 通 用规范
- 珠海市辅警笔试真题2025
- 跨境犯罪打击-洞察及研究
- 2026秋季中国东方航空股份有限公司综合管理部卫生保健岗位招聘考试模拟试题及答案解析
- 国际道路应急预案
- 物业保洁员职业安全培训手册
- 辽宁省工程咨询集团有限责任公司笔试题库
评论
0/150
提交评论