作者aecho (星空下的鲔鱼)
看板MacDev
标题Re: [问题] viweDidUnload该填的内容为何?
时间Wed Aug 5 09:49:20 2009
※ 引述《denru01 (阿儒)》之铭言:
: [cell.contentView addSubview:textField];
查到的addSubView,他会做retain的动作,而在removeFromSuperview时会做release。
addSubview:
Adds a view to the receiver’s subviews so it’s displayed above its siblings.
- (void)addSubview:(UIView *)view
Discussion
This method also sets the receiver as the next responder of view. The
receiver retains view. If you use removeFromSuperview to remove view from the
view hierarchy, view is released. If you want to keep using view after
removing it from the view hierarchy (if, for example, you are swapping
through a number of views), you must retain it before invoking
removeFromSuperview.
Availability
* Available in iPhone OS 2.0 and later.
--
或许人生是一段整合内在的自己
并寻求人间一点真情的过程吧
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.120.59.242
1F:→ atst2:波我刚回头看了一下,你应该不是因为textField crash 08/05 10:13
2F:→ atst2:而是因为cell 08/05 10:13
3F:→ atst2:把cell的autorelease拿掉吧 08/05 10:13
4F:→ atst2:更正,上面当我没说,没看到if....= = 08/05 10:14
5F:推 denru01:因为我只要一加[textField release]就会crash 08/05 11:21
6F:→ denru01:错误讯息又说似乎是送信息给已被释放的物件 08/05 11:22
7F:→ atst2:@property(nonatomic, assign) ---会不会是这个问题? 08/05 12:01
8F:→ atst2:TextField release时,应该会同时release delegate, 08/05 12:02
9F:→ atst2:因此有可能造成release两次. 08/05 12:02
10F:→ atst2:你可以做个实验,将delegate设成别人,而非self. 08/05 12:03
11F:→ atst2:看是不是还会有问题?(记得设完後不要做release动作) 08/05 12:04
12F:→ zonble:setDelegate 是不会 retain 的 08/05 15:11