Objective c 使用CoreText格式化UILabel和UIImage

Objective c 使用CoreText格式化UILabel和UIImage,objective-c,nsstring,uiimage,core-text,Objective C,Nsstring,Uiimage,Core Text,我并没有对核心文本进行深入研究,但我认为这是唯一可行的方法,但谁知道呢。 所以我有一个服务器,它向我发送信息: NSString *text = @"hello, today is best day"; NSArray *images; // array of url's from server to images (http://80.89.ru/123.png ....) // I don't know how many url's there will be 我有一个窗口,在这个窗口中

我并没有对核心文本进行深入研究,但我认为这是唯一可行的方法,但谁知道呢。 所以我有一个服务器,它向我发送信息:

NSString *text = @"hello, today is best day";
NSArray *images; // array of url's from server to images (http://80.89.ru/123.png ....) 
// I don't know how many url's there will be
我有一个窗口,在这个窗口中,我需要用这个字符串和所有图片正确地绘制UILabel,这些图片是我用这个文本从服务器获得的。 因此,我在InterfaceBuilder中配置了UILabel,并将带有图像的标签配置到ViewController中

@interface ViewC()
{
   UILabel *longStringFromServer;
}

- (void)viewDidLoad
{
    int y = 20; int x = 20;
    for (NSString *url in images)
    {
        UIImageView *view = [UIImageView alloc] initWithFrame....];
        y += 50; 
        // load image by url into UIImageView
    }
    longStringFromServer = text;
}
我所拥有的:

我需要的是:


我怎样才能在第二张照片上达到这个结果

我现在无法查看,但可以在使用核心文本渲染时创建排除区域。这将使文本环绕该区域。添加图像帧作为排除区域。该区域是否可以在图像编号的情况下动态创建?你能给我举个例子说明如何使用NSString和UILabel实现这一点吗?这可能是一个关于实现这一点的伟大教程的副本:使用TextKit和NSTextContainer的排除路径在这种情况下可能会对你有所帮助。