Search code examples
iphonesmsmkmapviewuserlocation

current location with map


hai I am creating an application. I want to sent the users current location with map using gps and without gps as sms. Is it possible? Please help me if anybody knows. Give some sample tutorial or code. Thank you


Solution

  • you can take screen shot of mapview through the following code and send multimedia SMS through the link

     - (UIImage *)captureView:(UIView *)view 
    {
        CGRect screenRect = [[UIScreen mainScreen] bounds];
    
       UIGraphicsBeginImageContext(screenRect.size);
    
      CGContextRef ctx = UIGraphicsGetCurrentContext();
      [[UIColor blackColor] set];
      CGContextFillRect(ctx, screenRect);
    
      [view.layer renderInContext:ctx];
    
       UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    
      UIGraphicsEndImageContext();
    
      return newImage;
    }