can me please.
code:
-(uiimage*)resizedimagewithbounds:(cgsize)bounds { cgfloat horizontalratio = bounds.width / self.size.width; cgfloat verticalratio = bounds.height / self.size.height; cgfloat ratio = min(horizontalratio, verticalratio); cgsize newsize = cgsizemake(self.size.width * ratio, self.size.height * ratio); uigraphicsbeginimagecontextwithoptions(newsize, yes, 0); [self drawinrect:cgrectmake(0, 0, newsize.width, newsize.height)]; uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return newimage; } what min() do?
i tried using in app , wasn't recognized, doesn't seem part of standard library/framework.
appears macro, based on decision name in capitals. (i'll honest, xcode suggested me. suspected macro, didn't occur me there might naming convention... i've used whatever names feel macros.)
if had guess, i'd somewhere in header import (or possibly import header imports it... or possibly on) you'll find like
code:
#define min(a,b) (a<b)?a:b
that's guess though. macro typed replace every instance of min(a,b) ternary operator first checks if less b, , if is, return a, , if isn't, return b. in effect, returns lesser of , b, or finds minimum (my guess min short for) value of , b.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
Comments
Post a Comment