user2123173
user2123173

Reputation: 118

iOS view.hidden = NO not always working

My viewController is receiving notifications from background threads and updates the UI accordingly.

Using this piece of code

dispatch_async(dispatch_get_main_queue(), ^{
    self.myButton.hidden = NO;
    [self.view addsubview:someView];
});

What I observe every now and then (2/5 times) is that myButton is not visible. someView have been added. If I press the area where myButton is it becomes visible.

What is the correct way of updating the UI like this when called from a background thread, I thought this was it but it is obviously not working as I expected.

Upvotes: 2

Views: 3194

Answers (1)

Rajneesh071
Rajneesh071

Reputation: 31091

There is not any issue with this code, You should check that you are not hiding it elsewhere.

So just search for other part or your code where you have code self.myButton.hidden

Upvotes: 2

Related Questions