如何在ipad编码中将splitview添加到我的基于视图的应用程序中 [英] how can i add splitview to my viewbased app in ipad coding

查看:84
本文介绍了如何在ipad编码中将splitview添加到我的基于视图的应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用基于视图的应用程序启动了我的iPad应用程序。在前两个视图中
我添加了表视图。
现在作为第三个视图我想将splitView添加到视图中,为此我将splitview控制器添加到我的xib文件中。我怎么写编程部分。
请使用完整链接或源代码。

I am Started my iPad app using View-Based application. in first two views i added table views. Now as the third view i want add splitView to the view, for this purpose i added splitview controller to my xib file. how can i write programming part. any use ful links or souce codes please.

I am using view based class like as follows:
- (void)viewDidLoad
{
    [super viewDidLoad];

}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

我在哪里实现代码?
提前致谢。

where do i implement code? Thanks in advance.

推荐答案

据我所知,拆分视图控制器你必须创建新的基于分割视图的应用程序,或者你必须通过编程实现。为此你需要创建一个主视图控制器,它包含splitview和一个没有nib文件的表视图控制器,并包含表视图控制器添加一个显示详细信息的视图控制器

As i know about split view controller you have to create new split View based app or you have to implement through programmatically. for this you need to create one master view controller which hold splitview and one table view controller without nib file and contain table view controller add one more view controller which display details

写主控制器中的以下代码

实现如下代码:
in .h page

write the below code in master controller
implementing code like: in .h page

 UISplitViewController *splitViewController;
@property (nonatomic, retain) IBOutlet LeftViewController *left;
@property (nonatomic, retain) IBOutlet DetailViewController *right;

在.m页面

   // Do any additional setup after loading the view from its nib.
left = [[LeftViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *leftNav = [[UINavigationController alloc] initWithRootViewController:left];
right = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
UINavigationController *rightNav = [[UINavigationController alloc] initWithRootViewController:right];
left.detail = right;

splitViewController = [[UISplitViewController alloc] init];    
splitViewController.viewControllers = [NSArray arrayWithObjects:leftNav,rightNav, nil];
splitViewController.delegate = right;
self.view = splitViewController.view;

[left release];
[right release];

在viewDidLoad中写入的所有启动方法都不在viewWillAppear中

all the start up method written in viewDidLoad not in viewWillAppear

这篇关于如何在ipad编码中将splitview添加到我的基于视图的应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆