我遇到了一个令我疯狂的问题......我知道它一定是一个简单的修复,但我在网上找不到任何东西(但是!可能正在寻找错误的地方)。子视图中的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