开发者

UITableView problem with iOS 5 beta 4&5 [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable t开发者_开发问答o the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I am using a table view to show information of a newsfeed. If you click on any of the cell's it will expand and will show all the information. If you click it again the cell will collapse. This worked so far on the iOS 4 till 4.3. But when I was testing it in the new beta's there were some problems.

To start of, it looks like indexPath has changed. The code below isn't properly functioning anymore. I used this to recognize the cell which has to be expanded.

if (selectedIndexPath == indexPath) {

Does anyone know what exactly changed? And how to correct the above code?

Thnx


Except in rare circumstances, you shouldn't be using pointer equality to represent object equality.

You should almost always be doing:

if ([selectedIndexPath isEqual:indexPath]) {

The base implementation of isEqual: in NSObject is simply doing a pointer comparison, and then classes that need specific implementations override it to do their own logic.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜