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开发者_如何学C 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
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
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.
精彩评论