1.frame(修改位置和尺寸):以父控件左上角為坐標原點,在其父控件中的位置和尺寸。
//frame屬性中的坐標點不能直接修改 CGRect tempFrame = self.v.frame; // 1.取出原來的屬性
tempFrame.origin.y+=10;//2.坐標點y加10 相當於向下移動10
self.v.frame=tempFrame;//3.賦值
2.bounds(修改尺寸):以自己左上角為坐標原點(x=0,y=0),控件的位置和尺寸。
//因為其始終以自身左上角為坐標原點,所以只能修改尺寸,修改位置不會改變 CGRect tempBounds = self.v.bounds;
tempBounds.size.height-=10;
tempBounds.size.width-=10;
self.v.bounds=tempBounds;
3.center(修改位置):以父控件的左上角為坐標原點,其控件中點的位置。
CGPoint tempCenter = self.v.center;
tempCenter.y -= 10;
self.v.center = tempCenter;
4.transform(修改位置、尺寸、旋轉角度)
//修改位置 UIButton *v = (UIButton *)[self.view viewWithTag:1]; v.transform=CGAffineTransformTranslate(v.transform, 0, -10); //修改尺寸 v.transform=CGAffineTransformScale(v.transform, 2, 2);//增大倍數 //修改角度// 角度是正數:順時針, 角度是負數:逆時針 v.transform=CGAffineTransformRotate(v.transform, -M_PI_4); //向左旋轉45°
