Note that there are some explanatory texts on larger screens.

plurals
  1. POtab bar item position not lined up with the background of the bar
    primarykey
    data
    text
    <p>Im having trouble trying to implement my own design to a tab bar. Somehow the items and background don't align correctly even tho they have the same height. The buttons seem to be further up than the background and i can't figure out why.</p> <p>Code for implementing the items/buttons: (this is added in my "viewDidLoad" in "Tab1ViewController.m", wich is the first of my 5 view controllers)</p> <pre><code>UIImage *selectedImage0 = [UIImage imageNamed:@"searchSEL"]; UIImage *unselectedImage0 = [UIImage imageNamed:@"search"]; UIImage *selectedImage1 = [UIImage imageNamed:@"homeSEL"]; UIImage *unselectedImage1 = [UIImage imageNamed:@"home"]; UIImage *selectedImage2 = [UIImage imageNamed:@"dareSEL"]; UIImage *unselectedImage2 = [UIImage imageNamed:@"dare"]; UIImage *selectedImage3 = [UIImage imageNamed:@"starSEL"]; UIImage *unselectedImage3 = [UIImage imageNamed:@"star"]; UIImage *selectedImage4 = [UIImage imageNamed:@"friendsSEL"]; UIImage *unselectedImage4 = [UIImage imageNamed:@"friends"]; UITabBar *tabBar = self.tabBarController.tabBar; UITabBarItem *item0 = [tabBar.items objectAtIndex:0]; UITabBarItem *item1 = [tabBar.items objectAtIndex:1]; UITabBarItem *item2 = [tabBar.items objectAtIndex:2]; UITabBarItem *item3 = [tabBar.items objectAtIndex:3]; UITabBarItem *item4 = [tabBar.items objectAtIndex:4]; [item0 setTitle:@""]; [item1 setTitle:@""]; [item2 setTitle:@""]; [item3 setTitle:@""]; [item4 setTitle:@""]; [item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0]; [item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1]; [item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2]; [item3 setFinishedSelectedImage:selectedImage3 withFinishedUnselectedImage:unselectedImage3]; [item4 setFinishedSelectedImage:selectedImage4 withFinishedUnselectedImage:unselectedImage4]; </code></pre> <p>and to add the background i just added this code to my didFinishLaunchingWithOptions in my appDelegate.m</p> <pre><code>UITabBar *tabBar = [UITabBar appearance]; [tabBar setBackgroundImage:[UIImage imageNamed:@"bg"]]; </code></pre> <p>The buttons are 64x49px and the background is 320x49px. </p> <p>I wont be able to answer to or read comments in a while, but I will as soon as i can, hopefully someone can help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload