开发者

iPhone: how to change label font-size by autosizing it for iPad app?

开发者 https://www.devze.com 2023-01-29 22:26 出处:网络
I want to convert an iPhone app into an iPad app For that I am autosizing the controls, for button it works fine.

I want to convert an iPhone app into an iPad app

For that I am autosizing the controls, for button it works fine.

Problem comes when I am Autosizimg the label the position of label changes relativ开发者_JAVA技巧ely but the font size of label remains same.

How to increase the label size (i.e. font size of label) by Autosizing label ?

Please Help & Suggest

Thanks.


One option would be to chose a very large default font size, and set

label.adjustsFontSizeToFitWidth = YES;

This will work for a single-line label. For multiline, you will need to do more.


I have dynamically added the check for whether the device is iPhone or iPad and set the font size of label text according to the current device

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) //Code for iPad else //Code for iPhone or iPod

0

精彩评论

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