




免费预览已结束,剩余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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030中国创新药医保谈判价格形成机制分析报告
- 2025-2030中国冷链物流网络优化需求与智慧化升级投资分析报告
- 垃圾分类投标书设备部分方案
- 山东淄博博山区城乡公益性岗位招聘考试真题2024
- 2025江苏徐州市泉山国有资产投资经营有限公司部门负责人选聘2人(二)考前自测高频考点模拟试题及答案详解(必刷)
- 2025年智能制造技术的应用与产业升级
- 2025年智能温控系统的节能效果分析
- 2025年智能农业的无人机监测技术
- 2025安徽宿州市萧县司法局萧县人民法院萧县公安局选任人民陪审员42人考前自测高频考点模拟试题附答案详解(完整版)
- 2025年国家统计局平顶山调查队面向社会公开招聘劳务派遣人员4名考前自测高频考点模拟试题及答案详解(名校卷)
- (初级)航空油料特设维修员(五级)理论考试题库-下(判断题)
- NB-T31052-2014风力发电场高处作业安全规程
- FZ-T 01158-2022 纺织品 织物刺痒感的测定 振动音频分析法
- 工程部造价管控手册
- 汽车销售三方协议
- 氧气吸入的注意事项课件
- 20以内加减法口算题(10000道)(A4直接打印-每页100题)
- 货架承载力计算单位公斤
- 畜牧兽医职称考试题库及答案
- 天惊牌中药消毒剂专家讲座
- 中国建设工程造价管理协会《建设工程造价鉴定规程》
评论
0/150
提交评论