I implemented the following code in my CustomViewController’s method viewDidLoad to switch a label visibility on/off depending on my needs:
- (void)viewDidLoad
{
[super viewDidLoad];
myLabel.hidden=NO;
if (x==1) {
myLabel.hidden=YES;//here is correctly hidden
}
else {
[self.view bringSubviewToFront:myLabel];
if(!myLabel.hidden){
NSLog(@"I'm not hidden!");// the log displays correctly! so myLabel is not Hidden but I can't see it!
[self.view bringSubviewToFront:myLabel];
}
}
MyLabel is declared in CustomViewController.h (“IBOutlet UILabel *myLabel;”) and connected to its corresponding UILabel interface in the Xib file.
Why Can’t I see it even if its “hidden”property is false?
P.s the UILabel text is assigned to the UILabel interface in the xib file
thanks
Luca
solved thanks guys I feel stupid.the label was out of the stage so I could see it.I just repositioned it and now it is working fine
For the sake of knowledge I answer my own question:the problem was that the label was out of the stage so I couldnt see it.I just repositioned it and now it is working fine