Hey everyone – I cant seem to figure out what i am doing wrong here. I create a button in my rootviewcontroller. I immediately hide it, when my parser is done that was started on a seperate thread I send it to a method that “unhides” my button. But… its not “unhiding” it.
Here is what i have in my ViewDidLoad of my RootViewController
showtimesButton = [UIButton buttonWithType:UIButtonTypeCustom];
image = [UIImage imageNamed:@"homeshowtimes.png"];
[showtimesButton setBackgroundImage:image forState:UIControlStateNormal];
showtimesButton.frame = CGRectMake(27, 390, 265, 63);
[showtimesButton addTarget:self action:@selector(showtimesButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:showtimesButton];
showtimesButton.hidden = YES;
and here is the method that is “unhiding” it. I put a break in this method so i know i am getting to it.
-(void)unhideShowtimesButton {
showtimesButton.hidden = NO;
}
any thoughts? thanks in advance!
Make sure you’re calling
unhideShowtimesButtonon the main thread:Where
anObjectis the object you’re doing the parsing in, if it’s in the same object at the button, useselfYou can’t interact with UI elements on anything other than the main thread.