0
votes

I am using this code for UILabel marquee. But i am not able to change the height of the label. I am using label font size as 60. Label text go out of bounds from its base side. Even after debugging for long time i am not able to find out the reason why me text is getting cut at the bottom.Any help is appreciated.

1
The above link has the two files attached. The code is vey big. I am using the same class given in the link.Prerna chavan

1 Answers

2
votes

Try using [string sizeWithFont:]. Code below works fine for me.

NSString* message=@"Polska pozdrawia";
CGSize fontSize=[message sizeWithFont:[UIFont systemFontOfSize:60.0f]];
AutoScrollLabel* label=[[AutoScrollLabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, fontSize.height)];
[label setFont:[UIFont systemFontOfSize:60.0f]];
[label setText:message];
[self.view addSubview:label];
[label scroll];