How to convert text to Image on iOS?

前端 未结 7 2294
庸人自扰
庸人自扰 2020-12-07 18:10

I am trying to write a function to convert the textfield text to an image (example). I have tried to search for an example, most of the sample also is overwrite text on imag

7条回答
  •  旧时难觅i
    2020-12-07 18:35

    NSString * ImgString = [[[self.dataDict valueForKey:@"newsItems"]objectAtIndex:indexPath.row]valueForKey:@"image"];
    
    NSURL *imageURL = [NSURL URLWithString:ImgString];
    NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
    UIImage *image = [UIImage imageWithData:imageData];
    
    cell.imageLabel.image = image;
    

    I want to present in table view so I am writing this code in cell for row at index path.

    (dataDict is my dictionary where I got all my data).

提交回复
热议问题