开始iPad开发的几天,我遇到了一些问题,
因为我创建了一个viewcontroller,其中显示了Deskboard等选项的数量,然后打开了splitview控制器
流程如下
View Controller
|
|->Splite view controller(with Tabbar controll)
|
|->Left controller(UITableview)
|
|->Right Controller(navigation controller)
因此我期望输出如下
所以任何人都可以指导解决问题。
有任何想法或解决方法吗?
如果我的问题不清楚,请告诉我。
谢谢和问候,
塞缪尔。
答案 0 :(得分:0)
请参阅我在app delegate中进行更改的内容。
steps1: 我拿了标签栏导航应用程序模板:
第2步: App Delegate .m文件中的更改将UISplitView控制器对象作为属性。
然后按照我的说法进行更改:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.splitController = [[UISplitViewController alloc] init];
[self.splitController setViewControllers:[NSArray arrayWithObjects:viewController1, viewController2, nil]];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:_splitController, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
它正在工作请注意内存管理
答案 1 :(得分:0)
请查看以下代码
添加一个新的视图控制器,用于处理名为MasterVctr的UISplitViewController 为左视图和右视图添加两个新控制器,名为LeftVCtr和RightVctr
在 MasterVCtr
中定义
@property(nonatomic, retain) IBOutlet UISplitViewController *splitViewController;
将以下代码添加到 viewDidLoad
中splitViewController = [[UISplitViewController alloc] init];
table = [[LeftVCtr alloc] initWithStyle:UITableViewStylePlain];
detail = [[RightVctr alloc] initWithNibName:@"RightVctr" bundle:nil];
UINavigationController *leftNav = [[[UINavigationController alloc] initWithRootViewController:table] autorelease];
UINavigationController *rightNav = [[[UINavigationController alloc] initWithRootViewController:detail] autorelease];
splitViewController.viewControllers = [NSArray arrayWithObjects:leftNav,rightNav, nil];
splitViewController.delegate = self;
self.view = splitViewController.view;
答案 2 :(得分:-1)
我通过Cocoa Matter解决方案解决了这个问题,感谢它
现在形成上述解决方案我增强了解决方案,现在解决了问题。
以下是解决方案的代码 .h文件
@property(nonatomic,retain)UISplitViewController *splitController;
.m文件
UIViewController *viewController5 = [[searchDetail alloc] initWithNibName:@"searchDetail" bundle:nil];
delegate.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, navForLogin, navForContact, viewController5, nil];
SearchVctr *viewController1 = [[SearchVctr alloc] initWithNibName:@"SearchVctr" bundle:nil];
FavouriteVctr *viewController2 = [[FavouriteVctr alloc] initWithNibName:@"FavouriteVctr" bundle:nil];
self.splitController = [[UISplitViewController alloc] init];
[self.splitController setViewControllers:[NSArray arrayWithObjects:viewController1, viewController2, nil]];
self.splitController.delegate = self;
viewController5.view=self.splitController.view;
delegate.tabBarController.selectedIndex = 4;
delegate.imgV.image=[UIImage imageNamed:[NSString stringWithFormat:@"t4_ipad.png"]];
delegate.tabBarController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
delegate.self.imgV.frame=CGRectMake(0, 0, 1024, 48);
[self presentModalViewController:delegate.tabBarController animated:YES];
感谢回复,