开发者

How to enable userinteraction in tableview when coming back to tableview

In my app I am doing tableView. By clicking row, the new view will navigate. Before navigation of new view, application is processing data from server. Until processing of data finished, view will not navigate. In this time period I want to disable userinteraction of tableview, so user can not select further rows.

- (void)tableView:(UITableView *)tableView di开发者_开发技巧dSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    tableView.userInteractionEnabled = NO;
}

Note that, When I again come back to the tableview, user will again allowed to select any row. I do not have any idea, how can I enable userinteracation again.


I assume that you are getting your data asynchronously. In this case, you can re-enable user interaction from your connection delegate method. If you are using NSURLRequest/NSUrlConnection, the delegate method would be: connectionDidFinishLoading: (don't forget also about connection:didFailWithError:).

From NSURLConnection Reference:

connectionDidFinishLoading:

Sent when a connection has finished loading successfully.

So, when the data is there and you are done with the processing, you re-enable the table view.


For Coming back after navigation, Put following sentence in your viewWillAppear That will again allow your table view user interaction to true.

tableView.userInteractionEnabled = YES;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜