第一次在这里提问。UIButton的子视图需要释放?
我有一个问题,我有一个UIImageView
添加作为一个子视图我UIButton
,这是使用buttonWithType:
(这意味着我不必松开按钮吧?)声明,但我还是要释放的子视图我的UIButton
?
码位:
UIImage *circleImage = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @"item-circle" ofType: @"png"]];
UIImageView *circleImageView = [[[UIImageView alloc] initWithImage: circleImage] autorelease];
[imageView setFrame: CGRectMake(-5, -5, 65, 65)];
UIButton *button = [UIButton buttonWithType: UIButtonTypeCustom];
[button addSubview: circleImageView];
欢迎来到StackOverflow!请记住标记答案是正确的,并注意提问的方式。 – Moshe 2011-03-23 03:58:33
谢谢:)哎呀注意到我已经autoreleased UIImageView,所以这是正确的? – purplelilgirl 2011-03-23 04:01:02
是的,看我的答案。 – Moshe 2011-03-23 04:05:06