开发者

Subviews deleted from table cells when row is added

My table cells consist of a UIView on the left side开发者_JS百科, a label in the center, and a label on the right.

I add new rows with

insertRowsAtIndexPaths:withRowAnimation:

The rows I add look just fine. But when each is added, an existing cell loses its UIView, but keeps both labels.

What could be causing this? The views keep a positive retain count the entire time, and the cell identifiers are all unique. Also, when I scroll down and then up, so that the cells have to be redrawn, the UIViews are again visible. When the row is added, cellForRowAtIndexPath is definitely only called on the new row.


I would really check the memory/retain logic. By the way, how are you sure that your retain count is correct? DO NOT RELY in retain count since it does not do as you expect it. I tried many times before and it is not reliable and therefore even often missleading.

Do you use ARC already?

Are you by any chance reusing the same variables (directly or indirectly) to create your UIiew?

Just for testing purposes make sure you really retain the views (for example add them to an mutablearray or so) and see what happens.

Also if you post some code, it will be much easier for us to help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜