我使用 将 a 添加UIImageView
到我的应用程序中IBOutlet
,然后以编程方式分配了图像,但图像未显示。我的代码如下所示:
NSString *string = @"Some text";
UIGraphicsBeginImageContext(CGSizeMake(180, 50));
[string drawAtPoint:CGPointMake(10, 20)
withFont:[UIFont systemFontOfSize:12]];
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//[imageview setImage:result];
//[imageview
sample.image =result;