简体   繁体   中英

UIView will not rotate?

I am trying to rotate a UIView , maybe i am doing something very stupid, but i can't seems to rotate that simple view :

 menuPointer=[[UIView alloc] initWithFrame:CGRectMake(k*width, height, 50, 50)];
    menuPointer.transform=CGAffineTransformMakeRotation(M_PI/2);
    menuPointer.backgroundColor=upperView.backgroundColor;
    [upperView addSubview:menuPointer];

What happens is that i see a rect , at the right size, but not rotated . Do i need to import something like Quartz ?

Try something like this?

menuPointer.transform = CGAffineTransformMakeRotation(DegreesToRadians(90));
#define DegreesToRadians(x) ((x) * M_PI / 180.0)

Found here: Link!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM