On Mar 27, 2012, at 2:57 AM, Giacomo Tufano wrote:

> That's what I use to generate a thumbnail of sideSize side lenght in iOS3.x 
> code.
> It uses iOS4+ functions for retina displays (I remember that you can assume 
> iOS4+ with retina displays).
> 
> CGSize newSize = CGSizeMake(sideSize, sideSize);
> #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
>       if(UIGraphicsBeginImageContextWithOptions != NULL)
>               UIGraphicsBeginImageContextWithOptions(newSize, NO, [[UIScreen 
> mainScreen] scale]);
>       else
> #endif
>               UIGraphicsBeginImageContext(newSize);
> UIGraphicsBeginImageContext(newSize);
> [self drawInRect:CGRectMake(0, 0, sideSize, sideSize)];
> // Get the new image from the context
> UIImage *thumbnailImage = UIGraphicsGetImageFromCurrentImageContext();
> // End the context
> UIGraphicsEndImageContext();
> 
> It works correctly on retina displays.
> To be honest I don't remember why I use that macro to test for iOS4, there 
> were a reason and that was a workaround but cannot remember why. It works, 
> anyway. :)


Your macro check is to attempt to remain compatible with the 3.2 or earlier 
SDK. It has served its purpose and can be retired :). If you no longer support 
iOS 3.x you can even remove the existence check for 
UIGraphicsBeginImageContextWithOptions.
--
David Duncan

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to