iPhone:如何通过针对 iPad 应用程序自动调整标签字体大小来更改标签字体大小?

发布于 2024-10-06 16:00:49 字数 193 浏览 0 评论 0原文

我想将 iPhone 应用程序转换为 iPad 应用程序

为此,我正在自动调整控件的大小,对于按钮,它工作得很好。

当我自动调整标签大小时,问题就出现了,标签的位置相对变化,但标签的字体大小保持不变。

如何通过自动调整标签大小来增加标签大小(即标签的字体大小)?

请帮助&建议

谢谢。

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 relatively 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦过后 2024-10-13 16:00:49

一种选择是选择非常大的默认字体大小,并设置

label.adjustsFontSizeToFitWidth = YES;

这将适用于单行标签。对于多行,您将需要做更多的事情。

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.

我也只是我 2024-10-13 16:00:49

我动态添加了对设备是iPhone还是iPad的检查,并根据当前设备设置标签文本的字体大小

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
//iPad 代码
别的
//iPhone 或 iPod 的代码

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文