English 中文(简体)
CGAffine TransformMakeRotation UILabel歪曲
原标题:CGAffineTransformMakeRotation UILabel distortion

I m试图以45度轮换一只三肢。 I m为transform property to CGAffine TransformMakeRotation (M_PI * 0.25),但当我这样做时,劳动调查组刚刚消失。 如果我改动<代码>0.25至0.26,我可以看到《国际统一劳工法》的概要(见下文)。

UILabel problem

https://i.stack.imgur.com/wG3I7.png” alt=“不轮换的单位”/。

Code: self.myLabel.transform = CGAffineTransformMakeRotation(M_PI * 0.26);

如果我错过任何可能有用的信息,请让我知道!

Update

It seems that the frame must be set before applying the rotation.

最佳回答

Your code should work fine, so something else is going on that you didn t post code for. I d recommend checking the autoresizing mask as well as anywhere else that may be manipulating the transform. From the appearance and your description, it almost seems like it is being rotated along the wrong axis via a 3D rotation causing you to view the label side on where it has a zero width/thickness, like looking at the edge of a paper head on.

问题回答

解决这一问题的另一个办法是,在另一种观点中插入你的职业名称,并利用外观在你的屏幕上贴上标签。

Another post had mentioned the problem that I m seeing with distortion or disappearing of the text in a UILabel. Their solution was to set all the outer springs on the UILabel. This worked for me, but then my label wasn t positioned properly on screen, especially during device rotation. So I thought embedding my UILabel in a container view would let me use the container view to position my label with just the top and right spring set while still allowing proper rotation of the UILabel within with the CGAffineTransformMakeRotation.

希望能帮助那些也存在这一问题的人。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签