views:

85

answers:

2

Hi all,

I am doing some work on uitable view in that I am showing 5 records at a time if the user wants to see more records user will tap on the more and another 5 records will be fetched .

all things are working properly except if I will tap on the more simultaneously the app crashes . so what I want to so is to disable the more when first time it is tapped and enable when the data id fetched .

thanks

+1  A: 

Assuming that the "more" is a button (control), you can disable it by setting the enabled property to NO or hide it by setting the hidden property to YES.

gerry3
no its a uitableviewcell
hib
just see how "more" works in App store iPhone application
hib
You control what happens when the cell is selected in the delegate method `tableView:didSelectRowAtIndexPath:`. You can choose to ignore it during the transition in which you are loading more cells. Or you could hide it by modifying what you return from the data source delegate methods.
gerry3
+2  A: 

In tableView:didSelectRowAtIndexPath: do the following if the indexPath corresponds to the morecell:

  • check if connection is already running
  • if yes -> do nothing
  • if no
    • morecell.selectionStyle = UITableViewCellSelectionStyleNone;
    • label.textColor = [UIColor lightGrayColor];
    • start connection

When the connection ends:

  • morecell.selectionStyle = UITableViewCellSelectionStyleBlue;
  • label.textColor = [UIColor blueColor];
  • add rows
Felix