UIBarButton ignores "setEnabled: YES"

I have a problem. I can’t understand why this is happening, maybe you guys can.

I created a UIBarButtonItem in IB and correctly bound it. Set a property and synthesized it. In the beginning, I installed btn disabled (viewWillAppear). Then I try to add an entry to mysql db:

NSString *URLStr = [NSString stringWithFormat:@"http://www.justfortestingandsoon.com/example.php?entry=%@", myEntry];
URLStr = [URLStr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSLog(@"URLStr: %@",URLStr);
NSURL *addURL = [NSURL URLWithString:URLStr];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:addURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
            urlConnectionSet = [NSURLConnection connectionWithRequest:urlRequest delegate:self];

In it "didReceiveData ..." I check what value is returned:

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    NSData *myData;
    myData = data;
    NSString *testString = [[NSString alloc] initWithData:myData encoding:NSASCIIStringEncoding];
    NSLog(@"receivedData: %@", testString);
if ([testString isEqualToString:@"ENABLED"]) {
        self.notificationBtnDeactivate.enabled = YES;
    }
...

I already debugged it. String self.notificationBtnDeactivate.enabled = YES; Called, but without any noticeable changes in the user interface.

Any ideas?

Thank you so much!

+3
source share
1 answer

I have two ideas for this:

+1

Source: https://habr.com/ru/post/1734107/


All Articles