Post

Replies

Boosts

Views

Activity

Subclassing UIButton doesn't change font size
Hi, here is a class for a UIKIT button. Some of those settings work, usch as cornerRadius: it does affect the button display, but some doesn't. For example, the size from    self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3) has no effect at all on the text of the font inside the buttons. Why is that? And how can I effectively alter the size of text from this subclass? class VotingButtonStyle: UIButton {       override func draw(_ rect: CGRect) {     super.draw(rect)     self.clipsToBounds = true     self.titleLabel?.font = UIFont(name: "Avenir Next Condensed Regular", size: 3)     self.setTitleColor(.black, for: .normal)     self.titleLabel?.numberOfLines = 3     self.layer.cornerRadius = 8   }     }
4
0
3.8k
Jun ’21
How to best handle this localization scenario?
Hello, here is a particular localization scenario i'm not sure how to handle with default localization feature: App base language is english, translation is french. 1) On app load, swift will pick up 6 random items from a strings array of 100 items. 2) It will display each of those 6 strings on 6 user interface buttons. 3) User will tap on a button: string value is sent back into app. Here is the problem: 4) App will do processing with this value. Problem is that all internal processing from that values that went out from the array on user interface then back in app, is all done with english values. In particular that user choice is saved in external database, and I can't have saved in database localized versions: all internal processing on array values in english. How best to handle this situation? Is it possible from a localized french VALUE, to get corresponding VALUE in base language? If yes how? Or should I build my own thing for those cases when random values goes out on UI, then back in app... like an array of tuples containing translated items?
5
0
878
May ’21
Tab bar item localization
Hi, tabBarItem.title = "LevelsVC-TabBarItem".localize() with tabBarItem.title i'm able to localize title when it is in viewDidLoad or viewWillappear but the localization will only happen when the tab becomes actives, otherwise it will show default value. How could I localize, programmatically, the item title without the need to make it active?
11
0
3k
May ’21