Reputation: 61
Basically my simple problem is programmatically created UILabel not appearing in IOS 7 simulator but it work on IOS 6 simulator and I'm using storyboard
my code is:
UILabel *lbl_top = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 100)];
lbl_top.text = text;
lbl_top.font = customFont;
lbl_top.numberOfLines = 1;
lbl_top.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;
lbl_top.adjustsFontSizeToFitWidth = YES;
lbl_top.adjustsLetterSpacingToFitWidth = YES;
lbl_top.minimumScaleFactor = 10.0f/12.0f;
lbl_top.clipsToBounds = YES;
lbl_top.backgroundColor = [UIColor clearColor];
lbl_top.textColor = [UIColor blackColor];
lbl_top.textAlignment = NSTextAlignmentLeft;
lbl_top.hidden = FALSE;
lbl_top.alpha = 1.0;
[self.view addSubview:lbl_top];
consol Print :
Printing description of lbl_top:
UILabel: 0x8dae430; frame = (10 100; 100 100); text = 'Power issues - Power Surv...'; clipsToBounds = YES; userInteractionEnabled = NO; layer = CALayer: 0x8db5f30
In IOS 6 Simulator
In IOS 7 Simulator
Upvotes: 1
Views: 471
Reputation: 146
I think you didn't set the text for that label proparly. set the text like
lolabel.text = @"Welcome";
and once check your font also may be your font is not supporting in iOS 7
.
Once change the font to default font and check it out.
Upvotes: 0
Reputation: 163
try this code
UILabel *lbl_top = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 100, 100)];
lbl_top.text = @"agssudass ";
lbl_top.font = [UIFont systemFontOfSize:15.0];
lbl_top.numberOfLines = 1;
lbl_top.baselineAdjustment = UIBaselineAdjustmentAlignBaselines;
lbl_top.adjustsFontSizeToFitWidth = YES;
lbl_top.adjustsLetterSpacingToFitWidth = YES;
lbl_top.minimumScaleFactor = 10.0f/12.0f;
lbl_top.clipsToBounds = YES;
lbl_top.backgroundColor = [UIColor blackColor];
lbl_top.textColor = [UIColor whiteColor];
lbl_top.textAlignment = NSTextAlignmentLeft;
lbl_top.hidden = FALSE;
lbl_top.alpha = 1.0;
[self.view addSubview:lbl_top];
changes are
lbl_top.text = @"agssudass ";
lbl_top.backgroundColor = [UIColor blackColor];
lbl_top.font = [UIFont systemFontOfSize:15.0];
lbl_top.textColor = [UIColor whiteColor];
Upvotes: 1