Skip to main content

Posts

Showing posts with the label frame

Resize Image Frame

Get the image frame size as per the image size ratio : -( CGRect )imagePosition:( int )imgWidth forImageHeight:( int )imgHeight maxFrame:( CGRect ) rect { float xPos=rect. origin . x , yPos=rect. origin . y ; int maxWidth=rect. size . width ; int maxHeight=rect. size . height ; float imgCWidth=imgWidth; float imgCHeight=imgHeight; float ratio= 0 ; if (imgCHeight> 0 ) ratio=( float )imgCHeight/( float )imgCWidth; if (imgCWidth>imgCHeight) { if (imgCWidth>maxWidth) { imgCWidth=maxWidth; imgCHeight=imgCWidth*ratio; } if (imgCHeight>maxHeight) { imgCHeight=maxHeight; imgCWidth=imgCHeight/ratio; } } else { if (imgCHeight>maxHeight) { imgCHeight=maxHeight; imgCWidth=imgCHeight/ratio; } if (imgCWidth>maxWidth) { imgCWidth=maxWidth; imgCHeight=imgCWidth*ratio; } } maxWidth=imgCWidth; maxHeight=imgCHeigh...