I am working on a application that demands users to show on the map like, when user register in to the application he/she upload its picture, when sending picture to server along with picture I scale the image to 0.1 so that its size could be reduced.
The thing is I have to show the user image like
The code to paste user image to this marker I used the code`
-(UIImage*) drawImage: (UIImage*) fgImage
inImage:(UIImage*) bgImage
atPoint:(CGPoint) point
{
UIGraphicsBeginImageContextWithOptions(bgImage.size, FALSE, 0.0);
[bgImage drawInRect:CGRectMake( 0, 0, bgImage.size.width, bgImage.size.height)];
[fgImage drawInRect:CGRectMake( point.x, point.y, fgImage.size.width, fgImage.size.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
fgImage is user pic image and bgImage is base image. this fuction returns me the complete image with green marker and rounded user image pasted on it. After that I pass this image to Map Marker
marker.icon = [self drawImage:[self makeRoundedImage:img radius:25] inImage:markerImage atPoint:CGPointMake((markerImage.size.width/2)-25, (markerImage.size.width/2)-25)];
The problem I am facing is I have created 70 testing users and App memory grows to 100 MB with so many custom markers on it. Please suggest me the best solution to handle this situation . Thanks.