I have the following code in my XCode project for an iOS app I’m developing:
testLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
UIFont *Font = [UIFont fontWithName:@"Arial" size:40];
[testLabel setFont:Font];
[testLabel setTextAlignment:UITextAlignmentCenter];
[testLabel setTextColor:[UIColor colorWithRed:(float) 55/255 green:(float) 41/255 blue:(float) 133/255 alpha:1.0]];
testLabel.text = @"Here We Go";
I am looking to put an image in that spot instead of the text. What do I need to replace this code with?
Either you make an image and put it in an
UIImageViewor you make aUIViewsubclass in which you will draw the text inside thedrawRectmethod.In the second case, in your
drawRectyou do this :Also, look HERE for a detailed explanation of these functions which can also take into account the available width, minimum sizes, line breaks, etc.