开发者

Adjust Text Field Size Based on current language iOS

开发者 https://www.devze.com 2023-04-08 04:04 出处:网络
Is it possi开发者_如何学运维ble to dynamically set the size of a text field, button or other visual atributes based on the current user selected language?

Is it possi开发者_如何学运维ble to dynamically set the size of a text field, button or other visual atributes based on the current user selected language?

Code sample would be great! Thanks for the help


You can easily adjust the size of a text field, for example depending on the text it contains.

NSString *localizedText; 
textField.text = localizedText;
[textField sizeToFit];
textField.text = @"";

You can generate localizedText dynamically with methods such as stringFromDate etc. or keep an NSDictionary with appropriate strings and the locales as keys.

0

精彩评论

暂无评论...
验证码 换一张
取 消