2013-07-18 120 views

回答

1

看起來沒有辦法改變UITabBarItem的圖像位置。我只是糾正了我選擇的圖像具有按鈕約15個,糾正的TabBar 15 UITabBarItem的標題的位置:didSelectItem:我自定義的方法的UITabBarController:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item 
{ 
    // If there is another selected item set default properties to it. 
    for (int counter = 0; counter < [self.tabBar.items count]; counter++) { 
     UITabBarItem *currentSelectedItem = [self.tabBar.items objectAtIndex:counter]; 
     [currentSelectedItem setTitlePositionAdjustment:UIOffsetMake(0, 0)]; 
    } 

    // Set selected item. 
    UITabBarItem *selectedItem = item; 
    [selectedItem setTitlePositionAdjustment:UIOffsetMake(0, -15)]; 
}