Objective C obtains pictures from remote addresses and modifies dimensions

From , 5 Years ago, written in Objective-C, viewed 75 times.
URL https://pastebin.vip/view/f8e6ba1d
  1. NSString* imageURL = [NSString stringWithFormat: @"http://theimageurl.com/?id=%@", [[resultsEntries objectAtIndex:0] objectForKey: @"image_large"]];
  2. NSData* imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:imageURL]];      
  3. UIImage* image = [[UIImage alloc] initWithData:imageData];
  4.  
  5. // resize image
  6. CGSize newSize = CGSizeMake(100, 100);
  7. UIGraphicsBeginImageContext( newSize );// a CGSize that has the size you want
  8. [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
  9.  
  10. //image is the original UIImage
  11. UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
  12. UIGraphicsEndImageContext();           
  13.  
  14. imageHeight = image.size.height;
  15. [imageMain setImage:newImage];
  16. [imageData release];
  17. [image release];
  18. //objectc/3903

Reply to "Objective C obtains pictures from remote addresses and modifies dimensions"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website