所以我有数据要在拍摄时叠加在照片上。这是我的代码。有没有更简单的方法可以在照片上叠加数据?
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *cameraImage = [info objectForKey:UIImagePickerControllerOriginalImage];
UIImageView *imageViewToSave = [[UIImageView alloc] initWithImage:cameraImage];
CGRect textFrame = CGRectMake(0, 0, imageViewToSave.frame.size.width-20, 325);
UILabel *tempLabel = [[UILabel alloc] initWithFrame:textFrame];
tempLabel.text = self.temperatureText.text;
tempLabel.font = self.imageLabelFont;
tempLabel.adjustsFontSizeToFitWidth = YES;
tempLabel.textAlignment = NSTextAlignmentRight;
tempLabel.textColor = self.tempGreen;
tempLabel.backgroundColor = [UIColor clearColor];
[imageViewToSave addSubview:tempLabel];
UIGraphicsBeginImageContext(imageViewToSave.bounds.size);
[imageViewToSave.layer renderInContext:UIGraphicsGetCurrentContext()];
cameraImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.library saveImage:cameraImage toAlbum:@"Node Therma" withCompletionBlock:^(NSError *error)
{
if (error!=nil)
{
NSLog(@"Big error: %@", [error description]);
}
}];
}