I’d like to draw “text” on some location on the screen without using UILabel, so i
[@"text" drawAtPoint:CGPointMake(100, 200)
withFont:[UIFont fontWithName:@"Arial" size:10.0]];
Nothing shows up however, though description of drawAtPoint reads:
Draws the string in a single line at the specified point in the
current graphics context using the specified font.
I suspect, my mistake is that i am calling it in my UIViewController's viewDidLoad method, and not placing onto the view? (But how?)
Again, using this way and avoiding the use of UILabel, how can text be placed on screen at custom location?
If you want to draw a string to a view, you will need to sub class a view and implement the drawRect method
Its because the string will be drawn in the curent context that is valid when you are calling it in drawRect, if you call [@”Your string” drawInRec… from your viewDidLoad it wont work because you dont have a valid context
Using
NSStringfro drawing and notUILabel, and you can usedrawInRect:withFont