TabBarItem大小和位置 [英] TabBarItem size and position

查看:110
本文介绍了TabBarItem大小和位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPad上创建标签应用程序。我在应用程序中有5个选项卡。因此我想调整这些标签的大小,因为标签栏上剩余了很多空间。甚至我得到的图像也更大。

I am creating tabbed application on iPad. I have 5 tabs in application. and hence i want to resize those tabs as there is lot of space remaining on tab bar. And even images i got for that are bigger.

我尝试调整tabBarItems的大小,但我找不到TabBatItem的任何直接属性,这将有助于我实现这一目标。我也用谷歌搜索,但找不到任何帮助。

I tried resizing tabBarItems but i couldn't find any direct property of TabBatItem which will help me in achieving this. I googled also but couldn't find any help about it.

我可以调整大小并定位我的tabbaritems吗?
如果没有,是否有任何解决方法?

Can i resize and position my tabbaritems? if not is there any workaround for that?

在这种情况下我是否需要采取任何其他类型的申请?

Do i need to take any other type of application in that case?

提前致谢

推荐答案

这个解决方案有点棘手,你可以试试这个 -

The Solution for this is a bit tricky, you can try this-

NSMutableArray *tabBarItems = [[[[[self.view subviews] objectAtIndex:1] subviews] mutableCopy] autorelease];

for (int item = 0; item < [tabBarItems count]; item++) {
    for (int subview = 0; subview < [[[tabBarItems objectAtIndex:item] subviews] count]; subview++) {
        if ([[[[tabBarItems objectAtIndex:item] subviews] objectAtIndex:subview] isKindOfClass:NSClassFromString(@"UITabBarButtonLabel")]) {
            [[[[tabBarItems objectAtIndex:item] subviews] objectAtIndex:subview] setFont:[UIFont systemFontOfSize:6.0f]];
            [[[[tabBarItems objectAtIndex:item] subviews] objectAtIndex:subview] setFrame: CGRectMake(x, y, width, height) 
            [[[[tabBarItems objectAtIndex:item] subviews] objectAtIndex:subview] setTextAlignment:UITextAlignmentCenter];
          }
     }
 }

这篇关于TabBarItem大小和位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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