frozenstruct / iOS-FinanceApp

This is a simple iOS Finance Tracking app implementing finance overview, graph view and expenses details view. WIP
1 stars 0 forks source link

GRLineView labels size to content #81

Closed frozenstruct closed 4 years ago

frozenstruct commented 4 years ago

Reference

global extension
frozenstruct commented 4 years ago
CGSize textSize = [[someLabel text] sizeWithFont:[someLabel font] forWidth:someLabel.bounds.size.width lineBreakMode:UILineBreakModeWordWrap];
frozenstruct commented 4 years ago
CGSize stringsize = [yourString sizeWithFont:[UIFont systemFontOfSize:fontSize]]; 
[label setFrame:CGRectMake(x,y,stringsize.width,height)];
[label setText: yourString];