看板 MacDev 關於我們 聯絡資訊
※ 引述《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
atst2:波我剛回頭看了一下,你應該不是因為textField crash 08/05 10:13
atst2:而是因為cell 08/05 10:13
atst2:把cell的autorelease拿掉吧 08/05 10:13
atst2:更正,上面當我沒說,沒看到if....= = 08/05 10:14
denru01:因為我只要一加[textField release]就會crash 08/05 11:21
denru01:錯誤訊息又說似乎是送信息給已被釋放的物件 08/05 11:22
atst2:@property(nonatomic, assign) ---會不會是這個問題? 08/05 12:01
atst2:TextField release時,應該會同時release delegate, 08/05 12:02
atst2:因此有可能造成release兩次. 08/05 12:02
atst2:你可以做個實驗,將delegate設成別人,而非self. 08/05 12:03
atst2:看是不是還會有問題?(記得設完後不要做release動作) 08/05 12:04
zonble:setDelegate 是不會 retain 的 08/05 15:11