Back button disabled iOS

In iOS, I navigate (moves) using the navigation controller, and in viewDidLoad launches a request. This request can take a long time, and I would like users to be able to return if they do not want to wait for the request.

The problem is that the back button added in the navigation bar seems to be locked until the request completes. The button remembers user interaction, and when the request ends, it automatically returns.

The request has a delegation method for responding, and when the application enters this method, the button will start and return.

If I touch during the request, the click / click effect does not appear on the button, and it is not at the end of the request. When I wait until the end, the button had a normal effect for the touch / click button.

+3
source share
2 answers

To do this, you can include a button property like this.

 [button setEnable:Yes];
 [button setEnable:Yes];

also use this

 [button setuserintractionEnable:no];
0
source

calling your request in backgroundthread like

    [self performSelectorInBackground:@selector(startRequest) withObject:nil];

and remember this always for master data. it is that your user interface will be removed and the request will continue to work in the background thread and then cancel the request for the button

initialize obj as

Obj * obj = [[Obj alloc] initWithDelegate: self selector: @selector (requestFinished)];  [self performSelectorInBackground: @selector (startRequest:) withObject: obj]; obj SEL selector id delegate;

if ([obj.delegate SoSelector: obj.selctor]) {  [obj.delegat performSelector: obj.selector]; }

,

0

All Articles