I want to calculate the height of a tableviewcell according to its text. I'm using
CGSize userInputSize = [userLabel sizeWithFont:[UIFont fontWithName:@"Arial" size:18.0f] forWidth:[tableView frame].size.width-10 lineBreakMode:NSLineBreakByWordWrapping]
but somehow the return value is always 22 (size of the font). Strange thing is that when I'm using
CGSize userInputSize = [userLabel sizeWithFont:[UIFont fontWithName:@"Arial" size:18.0f] constrainedToSize:[tableView frame].size lineBreakMode:NSLineBreakByWordWrapping];
all works fine. But I would prefer the first version, so I can easily adjust the width. Why isn't it working?
Edit: sorry for the bad name convention, but userLabel is a NSString not a label