开发者

how to rotate UI segmented control

开发者 https://www.devze.com 2023-01-12 10:11 出处:网络
hey all i want to know rotate the UI Segmented control to be开发者_StackOverflow in a vertical look

hey all i want to know rotate the UI Segmented control to be开发者_StackOverflow in a vertical look

cheer

BOB


You can do in this way.

#define degreesToRadians(x) (M_PI * x / 180.0)
[...]
segControl.transform = 
                CGAffineTransformRotate(segControl.transform, degreesToRadians(90));

if you want set correct position, remember that it consider the center of segControl!

ex:

segControl.frame = CGRectMake(-125, 220, 320, 30);

hope this helps.


I haven't done something like that before but I think one approach could be to subclass UISegmented control and use Affine Transforms related functions inside the Core Graphics framework, there you use for example CGContextRotateCTM() to give a 90 degrees rotation. Hope this helps.

0

精彩评论

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