में टूलबार आइटम फ़ॉन्ट आकार IOS7 के लिए कुछ ऐप्स बदल रहा है और टूलबार में रखे बटनों में टेक्स्ट के साथ समस्याएं हैं। ऐसा लगता है कि फ़ॉन्ट आकार बहुत बड़ा है और आकार बदलने के लिए संभव नहीं है। तो मेरे टेक्स्ट बटन जो आईओएस 6 में इतनी अच्छी तरह फिट बैठे हैं, अब और संभव नहीं हैं। स्क्रीन पर्याप्त चौड़ी नहीं है। क्या पूरे ऐप को फिर से शुरू किए बिना इसे समायोजित करना संभव है? यह बेवकूफ परिवर्तन क्यों? मैं वास्तव में ऐप को कई अन्य कारणों से आईओएस 7 में अनुकूलित करना चाहता हूं।आईओएस 7
Q
आईओएस 7
12
A
उत्तर
22
आप setTitleTextAttributes:forState:
का उपयोग कर UIBarItems (UIBarButtonItems सहित) के शीर्षक टेक्स्ट विशेषताओं को सेट कर सकते हैं। उदाहरण के लिए, सभी UIBarButtonItems के लिए शीर्षक टेक्स्ट का फ़ॉन्ट स्थापित करने के लिए, आप यह कर सकते हैं:
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:9.0]} forState:UIControlStateNormal];
या, बस एक के लिए यह निर्धारित करने के लिए,
[myBarButton setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:9.0]} forState:UIControlStateNormal];
तुम भी UIBarButtonItems कि UIButtons बना सकते हैं, और उन UIButtons कैसे दिखाई देते हैं (फ़ॉन्ट, फ़ॉन्ट आकार, आदि) पर पूरा नियंत्रण है। यह आपके UIToolbar पर एक UIButton खींचकर इंटरफ़ेस बिल्डर में किया जा सकता है, या कोड में:
UIButton* button = ...;
UIBarButtonItem* barButton = [[UIBarButtonItem alloc] initWithCustomView:button];
[toolbar setItems:@[barButton, ...] animated:YES];
ध्यान रखें कि आपके IBActions/segues UIButton बजाय UIBarButtonItem को झुका जा सकता है अगर आप यह तरीका अपनाते की आवश्यकता होगी ।
0
स्विफ्ट:
UIToolbar.appearance().barTintColor = TOOLBAR_BACKGROUND_COLOR
if let font = UIFont(name: "AvenirNext-DemiBold", size: 15) {
UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: font,NSForegroundColorAttributeName:TOOLBAR_TITLE_COLOR], forState: UIControlState.Normal)
}
संबंधित मुद्दे
- 1. आईओएस 7
- 2. आईओएस 7
- 3. आईओएस 7
- 4. आईओएस 7
- 5. आईओएस 7
- 6. आईओएस 7
- 7. आईओएस 7
- 8. आईओएस 7
- 9. आईओएस 7
- 10. आईओएस 7
- 11. आईओएस 7
- 12. आईओएस 7
- 13. आईओएस 7
- 14. आईओएस 7
- 15. आईओएस 7
- 16. आईओएस 7
- 17. आईओएस 7
- 18. आईओएस 7
- 19. आईओएस 7
- 20. आईओएस 7
- 21. आईओएस 7
- 22. आईओएस 7
- 23. आईओएस 7 और आईओएस 9
- 24. आईओएस - viewDidLayoutSubviews को आईओएस 7
- 25. क्या आईओएस ऐप आईओएस 7
- 26. आईओएस 7: आईओएस 7 में साझा करने से UIActivityViewController
- 27. UISlider आईओएस 7
- 28. GKPeerPickerController को आईओएस 7
- 29. आईओएस 7 AVMutableVideoCompositionLayerInstruction
- 30. आईओएस 7 - यूआईस्लाइडर thumbTIntColor
कि बहुत जल्द ही प्रयास करेंगे। –