2012-04-23 9 views
13

मैं TabBar उपस्थिति इस तरह केiOS5 TabBar फ़ॉन्ट्स और रंग

UIImage *tabBackground = [[UIImage imageNamed:@"tab-bar-bg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; 
[[UITabBar appearance] setBackgroundImage:tabBackground]; 
[[UITabBar appearance] setSelectionIndicatorImage: [UIImage imageNamed:@"activetab.png"]]; 

मैं कस्टम फोंट और चयनित और अचयनित किया गया पाठ रंग कैसे परिभाषित करते हैं अनुकूलित है?

धन्यवाद,

+1

एक नज़र http://stackoverflow.com/a/8412083/886407 – JiaYow

+0

पर ओह दुष्ट! मैंने खोज करने की कोशिश की, स्पष्ट रूप से पर्याप्त कठिन नहीं! धन्यवाद! –

उत्तर

18
[[UITabBarItem appearance] setTitleTextAttributes: 
    [NSDictionary dictionaryWithObjectsAndKeys: 
     [UIColor blackColor], UITextAttributeTextColor, 
     [UIFont fontWithName:@"font" size:0.0], UITextAttributeFont, 
     nil] 
              forState:UIControlStateHighlighted]; 
+1

नोट यह केवल आईओएस 5 में और –

+0

शीर्षक के लिए किनारे सेट करने के लिए कैसे काम करता है? –

+0

@ बुरहानुद्दीनसुनेलवाला सेटटाइटप्लाइजेशन समायोजन: (यूआईओफ़सेट) समायोजन – JerryZhou

13
[[UITabBarItem appearance] setTitleTextAttributes: 
    [NSDictionary dictionaryWithObjectsAndKeys: 
     [UIColor blackColor], UITextAttributeTextColor, 
     [UIFont fontWithName:@"ProximaNova-Semibold" size:0.0], UITextAttributeFont, 
     nil] 
              forState:UIControlStateHighlighted]; 


    [[UITabBarItem appearance] setTitleTextAttributes: 
    [NSDictionary dictionaryWithObjectsAndKeys: 
     [UIColor grayColor], UITextAttributeTextColor, 
     [UIFont fontWithName:@"ProximaNova-Semibold" size:0.0], UITextAttributeFont, 
     nil] 
              forState:UIControlStateNormal]; 
1

ऊपर जवाब मेरे लिए काम कर रहा है।

लेकिन मुझे लगता है कि ज्यादातर लोगों को बदलना चाहिए forState:UIControlStateHighlightedforstate:UIControlStateSelected को

संबंधित मुद्दे