如何在iOS中倾斜UI标签 [英] How to angle a uilabel in ios

查看:55
本文介绍了如何在iOS中倾斜UI标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个iphone应用程序.在该应用程序中,我想根据所附的屏幕截图对标签进行调整.(请参阅$ 120标签)

i'm creating an iphone app.in that application i want to angle the label according to the attached screen shot. (see the $ 120 lable)

红色图片位于背景中,我想将uilabel顶部调整角度

The red color image is in the background and i want to angle the uilabel top of it

我使用了 transform 方法旋转.但是它不能正确地倾斜它.标签缩小

I have used the transformmethod to rotate . But it does not properly angle it. label shrinks

testLabel.transform = CGAffineTransformMakeRotation(30 * M_PI / 180.0);

推荐答案

由于设置了错误的框架,您的标签缩小了.您应该将标签放置在 UIView 中,然后旋转该视图而不是标签.还要检查您的 UIView 是否未启用任何自动调整大小的锚点.

Your label shrinks due to setting wrong frame. You should place your label into the UIView and rotate this view instead of label. And also check your UIView have no any autoresizing anchors enabled.

这篇关于如何在iOS中倾斜UI标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆