iOS-视图旋转和调整大小

iOS-视图旋转和调整大小,ios,iphone,objective-c,Ios,Iphone,Objective C,这是我的观点 什么时候 会的 现在,当我旋转视图时 再来一次 self.myView.transform = CGAffineTransformMakeRotation(M_PI*0/180); [self.myView setFrame:CGRectMake:(self.myView.frame.orgin.x,self.myView.frame.orgin.y,300,self.myView.frame.size.height)]; 这里发生了什么事 看起来像是宽度被拉伸了 是否

这是我的观点

什么时候

会的

现在,当我旋转视图时

再来一次

self.myView.transform = CGAffineTransformMakeRotation(M_PI*0/180);

[self.myView setFrame:CGRectMake:(self.myView.frame.orgin.x,self.myView.frame.orgin.y,300,self.myView.frame.size.height)];

这里发生了什么事

看起来像是宽度被拉伸了


是否仍要修复它或使用其他方法旋转和调整大小?

您应该使用
边界
中心
属性来调整和放置视图,如果变换属性不是标识变换,则不应使用框架

(请参见第页的警告)


frame.size
不等于
bounds.size
旋转视图时,如果希望视图的宽度为300,则应设置边界

谢谢您的回答!它的工作!
self.myView.transform = CGAffineTransformMakeRotation(M_PI*0/180);

[self.myView setFrame:CGRectMake:(self.myView.frame.orgin.x,self.myView.frame.orgin.y,300,self.myView.frame.size.height)];