UITableView problem with iOS 5 beta 4&5 [closed]
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.
精彩评论