2010-01-18 75 views

回答

19

,則應該設置在框架屬性:

myView.frame = CGRectMake(10,10,200,100); 

這將定位在位置(10,10)的圖,其中尺寸的黑白200x100

3

同意。 請注意,您無法單獨更改座標,正如您所期望的那樣。也就是說,這不起作用:

self.mysubview.frame.origin.x += 17; // FAILS! Not assignable!! 

如果這是一個痛苦的計算所有其他的座標,你需要,你可以(一)吸起來或(b)這樣做如下:

CGRect theFrame = self.mysubview.frame; 
theFrame.origin.x += 17; 
self.mysubview.frame = theFrame; // this is legal