开发者

Adding tags to Images a cross between facebook & map pointers

I intend to make an app that adds a layer of text or pointers to images. Kinda like adding another layer text/pointer over an ima开发者_如何学Goge displayed in iphone.

ALSO, upon exporting, i want that image with the added text over it to be clubbed with the new "exported" image.

Im puzzeled as to how to start this..?

any ideas or references would be greatly appreciated.


Well, the easiest way is to add all the load the uiimageview, and the other views on a single parent view and

@implementation UIView (Imaging)

-(UIImage *) getSnapshotImage
{
    UIGraphicsBeginImageContext(CGSizeMake(self.bounds.size.width, self.bounds.size.height));
    CGColorSpaceRef color = CGColorSpaceCreateDeviceRGB();
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
    CGColorSpaceRelease(color);
    UIGraphicsEndImageContext();
    return outputImage;
}

@end

once you have the UIImage, convert it to JPEG or PNG using

NSData * UIImageJPEGRepresentation (
   UIImage *image,
   CGFloat compressionQuality
);

which you can then proceed to store it in a file

- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜