-1

几天开始iPad开发,我遇到了一些问题,

我创建了一个视图控制器,其中显示了桌面等选项的数量,然后在打开拆分视图控制器之后

流程如下

View Controller
   |
   |->Splite view controller(with Tabbar controll)
                |
                |->Left controller(UITableview)
                |
                |->Right Controller(navigation controller)

因此我期望输出如下

在此处输入图像描述

所以任何人都可以指导解决问题。

伙计们有什么想法或解决方法吗?

如果我的问题不清楚,请告诉我。

谢谢并恭祝安康,

塞缪尔。

4

3 回答 3

0

请查看我在应用程序委托中所做的更改。

step1:我拿了一个标签栏导航应用模板:

第 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;
}

它工作正常,请注意内存管理

于 2012-05-21T20:45:47.810 回答
0

请查看以下代码

添加一个用于处理 UISplitViewController 的新视图控制器,称为 MasterVctr
添加两个用于左视图和右视图的新控制器,称为 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;
于 2012-05-22T05:10:10.427 回答
-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];

谢谢回复,

于 2012-05-22T05:18:31.927 回答