I have a long string called theString
in my code, which I'm passing to the drawRect:
method to draw on screen.
-(void)drawRect:(CGRect)rect
{
[super drawRect:rect];
[theString drawInRect:CGRectMake(0, 0, self.bounds.size.width, 200)];
}
As you can see, I can just set the width to the screen size, but the height has to be set manually, which is a problem when the strings being passed are of differing lengths. How do I automatically detect the height the frame needs to be? Also in the future I may be extending this to include an attributed string of differing font styles, so counting characters may not be a very good option.