kiran kumar
kiran kumar

Reputation: 1359

UILabel display problem

enter image description here

In the above figure it shows...

I need to display complete data in UILabel.

This is an alignment problem with UILabel

UILabel *lable=[[UILabel alloc]init];
lable.frame=CGRectMake(350, 25, 50, 50);
[lable setTextColor:[UIColor whiteColor]];
[lable setBackgroundColor:[UIColor clearColor]];
[lable setText:@"Leveraged Commentary & Data"];

I need to display completed setText on lable @"Leveraged Commentary & Data";

Please help me out.

Thanks in advance

Upvotes: 0

Views: 262

Answers (4)

NIKHIL
NIKHIL

Reputation: 2719

UILabel *lable=[[UILabel alloc]init];

lable.frame=CGRectMake(350, 25, increase this value , 50);
[lable setTextColor:[UIColor whiteColor]];
[lable setBackgroundColor:[UIColor clearColor]];
[lable setText:@"Leveraged Commentary & Data"];

You need to increase the width of the label

Upvotes: 3

Alexei Sholik
Alexei Sholik

Reputation: 7469

Make your label's frame wider, it's only 50 points according to your code. NSString has a method sizeWithFont:forWidth:lineBreakMode: which allows you to get the dimensions of the text.

Here's a similar question with an accepted answer.

Upvotes: 0

Chetan Bhalara
Chetan Bhalara

Reputation: 10344

You can do two things for display complete text.

1) Increase the width of UILabel.

2) Increase the height and set no of lines.

Upvotes: 1

PgmFreek
PgmFreek

Reputation: 6402

Can you increase the label width. Label is too small to display the text.Try this

lable.frame=CGRectMake(350, 25, 350, 50);
lable.adjustsFontSizeToFitWidth = NO;

Upvotes: 0

Related Questions