Take the 2-minute tour ×

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.

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.

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?

Thanks in advance

share|improve this question
add comment

1 Answer

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];
share|improve this answer
If you are using iOS 5.0 then there is a better solution for this, use setTitleTextAttributes method. –  rishi Jan 4 '12 at 16:34
hi, both of these are not increasing size of tabBarItem. in setTitleTextAttributes we can not mention frame size. and the code that you have given is not working for me. is there any thing more that i need to do while using above code? –  prajakta kulkarni Jan 4 '12 at 18:28
Have you tried to debugged the code?What is exactly happening there. Also following is link where setTitleTextAttributes method is discussed. –  rishi Jan 5 '12 at 5:00
i think this is increasing size of text and not increasing size of tabs.:( –  prajakta kulkarni Jan 5 '12 at 5:19
add comment

Your Answer


