在没有情节提要的情况下限制uitabbarviewcontroller ios7的视图高度

尼兰詹·巴尔克里希纳(Niranjan Balkrishna Prajapati)

我有一个tableviewcontroller,在tableviewcontroller的相应rowclick上,我想显示该相应行的详细信息的细节。

行详细信息视图将具有固定的内容,如下所示:

  1. 标头
  2. 标头下方的标题
  3. 与标题相关的图片
  4. 在这里,我想显示uitabbarcontroller选项卡按钮的各个视图

在上述几点中,第1-3点的内容将覆盖固定位置的ViewController的页面的一半,并且ViewController的下半部分将具有第4个点,即各个选项卡按钮的视图将根据为各个选项卡创建的视图而改变。

我无法找到任何解决方案来固定视图的上半部分。以及如何将标签栏的视图限制在屏幕的下半部分。

我在不使用Storyboard的情况下执行此应用程序

搜索了很多,但没有任何解决方案。

请提供一些示例代码或教程(如果有)。

以下是我确切想要的图像,因为我在android中创建了相同的图像。

抱歉,需要模糊图像的内容。

在此处输入图片说明

在上图中,以下是我要修复的问题:

  1. 顶部的蓝色条是标题,它将保持不变。
  2. 标头下方的棕条和标头下方的发白图像也已修复。
  3. 图像下方的四个按钮是标签栏按钮,它们在IOS中将显示在屏幕底部。
  4. 标签栏按钮下方是包含第一个标签栏按钮内容的视图。

My question is i want the first 2 of above points be fixed and the viewcontroller containing the views for respective tabbarbuttons should be seen on the rest half of the screen with the 4 tabbar buttons.

So if i click on any of the tab buttons only its view which is occupied by bottom half of the screen will change & the top half will remain static(fixed).

Hope my explaination make clear some doubts about the question.

----EDITED SOLUTION based on what @Simon McLoughlin suggested, following is the code:

I have implemented a function in which i have written code for implementing my scenario.

-(void)loadShowDetailsTabBarController
{
    ConceptViewController *conceptViewController;
    CastViewController *castViewController;
    ShowDetailsFeedbackViewController *showDetailsFeedbackViewController;
    PromosViewController *promoViewController;

    UIImage *conceptBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
    UIImage *conceptBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];


    UIImage *castBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
    UIImage *castBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];

    UIImage *feedbackBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
    UIImage *feedbackBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];

    UIImage *promoBtn = [UIImage imageNamed:@"showdetailstabidle_btn_bg.png"];
    UIImage *promoBtnSelected = [UIImage imageNamed:@"showdetailstabselected_btn_bg.png"];

    conceptBtn = [conceptBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    conceptBtnSelected = [conceptBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    castBtn = [castBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    castBtnSelected = [castBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    feedbackBtn = [feedbackBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    feedbackBtnSelected = [feedbackBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    promoBtn = [promoBtn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    promoBtnSelected = [promoBtnSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
    {
        conceptViewController = [[ConceptViewController alloc] initWithNibName:@"ConceptViewController_iPad" bundle:nil];

        castViewController = [[CastViewController alloc] initWithNibName:@"CastViewController_iPad" bundle:nil];

        showDetailsFeedbackViewController = [[ShowDetailsFeedbackViewController alloc] initWithNibName:@"ShowDetailsFeedbackViewController_iPad" bundle:nil];

        promoViewController = [[PromosViewController alloc] initWithNibName:@"PromosViewController_iPad" bundle:nil];
    }
    else if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
        conceptViewController = [[ConceptViewController alloc] initWithNibName:@"ConceptViewController" bundle:nil];

        castViewController = [[CastViewController alloc] initWithNibName:@"CastViewController" bundle:nil];

        showDetailsFeedbackViewController = [[ShowDetailsFeedbackViewController alloc] initWithNibName:@"ShowDetailsFeedbackViewController" bundle:nil];

        promoViewController = [[PromosViewController alloc] initWithNibName:@"PromosViewController" bundle:nil];

    }

    conceptViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"CONCEPT" image:conceptBtn selectedImage:conceptBtn];

    castViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"CAST" image:castBtn selectedImage:castBtnSelected];

    showDetailsFeedbackViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"FEEDBACK" image:feedbackBtn selectedImage:feedbackBtnSelected];

    promoViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"PROMO" image:promoBtn selectedImage:promoBtnSelected];/**/

    UITabBarController *showDetailstabVC = [[UITabBarController alloc] init];

    showDetailstabVC.viewControllers = [NSArray arrayWithObjects:conceptViewController,castViewController,showDetailsFeedbackViewController,promoViewController, nil];

    showDetailstabVC.view.frame = CGRectMake(0, 250, screenSize.width, screenSize.height-250);

    self.view.window.rootViewController = showDetailstabVC;

    [self.view addSubview:showDetailstabVC.view];
}

Please let me know if my code is correct?

I am able to view what i wanted.

But now the problem is when i click on the tabbar buttons i get the following error:

exc_bad_access (code=exc_i386_gpflt)

The error is not given in debug screen, The app stops at the following line in main.m :

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

Simon McLoughlin

Ok so it turns out what you are trying to achieve is a UIViewController split vertically. Top half being static and bottom half containing a UITabbarController that will display UIViewControllers that will only occupy the space between the UITabbar and the static view.

I thought this could be done with making the UITabbarController a child, but I could be wrong. I have had 3 child UIViewController's on a screen before by simply setting the frame. You've said above that that didn't work for you so I see 2 options left.

  1. You create all of the tabs content to be smaller. So for example say the top view is 100px in height. In the UIViewController's in the tabs, simply set the frame of the UITableView (or the view or whatever the content is) to start at 100px for its Y value. This is a fairly bad solution in my opinion however it would require the least effort to do.

  2. You create a "Master" UIViewController that has a static section at the top and a horizontally scrolling UIScrollView with paging enabled. And add the individual UIViewController's as child viewControllers to that. Not sure if you could create a Tabbar and listen for events and use that to programmtically scroll it, or if you would have to create your own UIView that looks like a Tabbar and put buttons on it to scroll left / right.

第二种方法是很常见的事情。我已经完成了一些应用程序,并且在网上看到了很多有关如何实现它的帖子。像这样:如何将viewController放入UIScrollView中它只是需要以增加的X添加子viewControllers并将scrollViews内容大小设置为total。打开Pagging,关闭垂直滚动。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在没有情节提要的情况下隔离视图

来自分类Dev

如何在没有情节提要的情况下快速推送新视图

来自分类Dev

在没有情节提要的情况下更改视图控制器

来自分类Dev

如何在没有情节提要的情况下学习iOS编程?

来自分类Dev

如何在没有情节提要的情况下学习iOS编程?

来自分类Dev

如何在没有情节提要的情况下以编程方式实例化视图控制器

来自分类Dev

iOS7情节提要模态segue更改子视图

来自分类Dev

在没有情节提要的情况下使用UIPageViewController

来自分类Dev

在没有情节提要的情况下使用UITableView

来自分类Dev

在没有情节提要的情况下使用UISearchController

来自分类Dev

在没有情节提要的情况下使用UITableView

来自分类Dev

iOS 8:如果没有情节提要,自动旋转将无法正常工作

来自分类Dev

编写没有情节提要的iOS 8共享扩展程序

来自分类Dev

在iOS7上视图是否有可能落下阴影?

来自分类Dev

如何在情节提要iOS7中正确重用模式视图/控制器

来自分类Dev

使用情节提要IOS7将UIview控制器显示为子视图

来自分类Dev

如何创建具有与iOS7和iOS8兼容的动态高度的UITableViewCells?

来自分类Dev

在没有情节提要或xib文件的情况下实例化UIViewController

来自分类Dev

如何在没有情节提要的情况下应用本地化

来自分类Dev

在没有情节提要的情况下创建和执行segue

来自分类Dev

Swift:如何在没有情节提要的情况下在Container View中更新数据

来自分类Dev

在没有情节提要的情况下以编程方式将其缝制到UINavigation Controller

来自分类Dev

在没有情节提要的情况下从xib加载UIView

来自分类Dev

在没有情节提要的情况下以编程方式加载UITableViewController

来自分类Dev

有没有一种方法可以在不使用UINavigationController的情况下更改情节提要中的UINavigationBar的高度?

来自分类Dev

带有Web视图的模式视图使应用程序在iOS7中崩溃

来自分类Dev

在没有导航控制器的情况下,在另一个情节提要中选择到视图控制器

来自分类Dev

IOs7多个情节提要本地化问题

来自分类Dev

IOs7多层情节提要本地化问题

Related 相关文章

  1. 1

    在没有情节提要的情况下隔离视图

  2. 2

    如何在没有情节提要的情况下快速推送新视图

  3. 3

    在没有情节提要的情况下更改视图控制器

  4. 4

    如何在没有情节提要的情况下学习iOS编程?

  5. 5

    如何在没有情节提要的情况下学习iOS编程?

  6. 6

    如何在没有情节提要的情况下以编程方式实例化视图控制器

  7. 7

    iOS7情节提要模态segue更改子视图

  8. 8

    在没有情节提要的情况下使用UIPageViewController

  9. 9

    在没有情节提要的情况下使用UITableView

  10. 10

    在没有情节提要的情况下使用UISearchController

  11. 11

    在没有情节提要的情况下使用UITableView

  12. 12

    iOS 8:如果没有情节提要,自动旋转将无法正常工作

  13. 13

    编写没有情节提要的iOS 8共享扩展程序

  14. 14

    在iOS7上视图是否有可能落下阴影?

  15. 15

    如何在情节提要iOS7中正确重用模式视图/控制器

  16. 16

    使用情节提要IOS7将UIview控制器显示为子视图

  17. 17

    如何创建具有与iOS7和iOS8兼容的动态高度的UITableViewCells?

  18. 18

    在没有情节提要或xib文件的情况下实例化UIViewController

  19. 19

    如何在没有情节提要的情况下应用本地化

  20. 20

    在没有情节提要的情况下创建和执行segue

  21. 21

    Swift:如何在没有情节提要的情况下在Container View中更新数据

  22. 22

    在没有情节提要的情况下以编程方式将其缝制到UINavigation Controller

  23. 23

    在没有情节提要的情况下从xib加载UIView

  24. 24

    在没有情节提要的情况下以编程方式加载UITableViewController

  25. 25

    有没有一种方法可以在不使用UINavigationController的情况下更改情节提要中的UINavigationBar的高度?

  26. 26

    带有Web视图的模式视图使应用程序在iOS7中崩溃

  27. 27

    在没有导航控制器的情况下,在另一个情节提要中选择到视图控制器

  28. 28

    IOs7多个情节提要本地化问题

  29. 29

    IOs7多层情节提要本地化问题

热门标签

归档