我遇到了一個令我瘋狂的問題......我知道它一定是一個簡單的修復,但我在網上找不到任何東西(但是!可能正在尋找錯誤的地方)。子視圖中的UIView起源
我有一堆,我在視圖中放置一個循環按鈕:
//make the button smaller and position
CGRect buttonFrame = button.frame;
buttonFrame.size = CGSizeMake(41, 41);
buttonFrame.origin = CGPointMake(10+(43*i), 415);
button.frame = buttonFrame;
這個工作很大......但現在我想將它們添加到另外的看法,它們就會消失。問題的代碼行是:
buttonFrame.origin = CGPointMake(10+(43*i), 415);
我相信,這一定是工作過self.view的座標,而不是保存按鈕新的子視圖。我是否需要一個新的CGContext用於超級視圖。
我想是這樣的:
buttonFrame.origin = [newView CGPointMake(10+(43*i), 415)];
但導致各種錯誤。
謝謝你的時間!
非常感謝,這是顯而易見的痛苦。我需要更多的睡眠。 – 2011-01-28 16:52:31