初学者的问题:我想有它添加到视图后删除子视图,然后将其释放,即我有:如何删除其发布的子视图
for (int i = 0; i < 9, i++) {
UIButton *btn = [indexButtons objectAtIndex:i];
btn.tag = x;
[notePage1 addSubview:btn];
[btn release];
}
我怎样才能摆脱这些btn之一,例如数字0?我想到了
UIButton *btn = [indexButtons objectAtIndex:0];
if ([btn isDescendantOfView:notePage1]) { [btn removeFromSuperview]; }
[btn release];
但是,这只会导致应用程序崩溃。我根本没有错误日志? - 应用程序只是终止。我如何正确地做到这一点?
谢谢!哦,亲爱的,我应该知道这一点...感谢提醒我 - 希望我会记得这一次! – 2011-05-25 15:07:35