//Create a path that is a rounded rectangle UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:newRect cornerRadius:5.0]; //Make all subsequent drawing clip to this rounded rectangle //I don't understand this code [path addClip]; //Center the image in the thumbnail rectangle //How does this block of code helps to center the image in the thumbnail rectangle and where's the thumnnail rectangle CGRect projectRect; projectRect.size.width = ratio *origImageSize.width; projectRect.size.height = ratio *origImageSize.height; //Aren't we suppose to make the origin (0,0)? projectRect.origin.x = (newRect.size.width - projectRect.size.width)/2.0; projectRect.origin.y = (newRect.size.height - projectRect.size.height)/2.0; //Draw the image on it //Draw image on using projectRect as the frame but where's the super frame, how will the image turned out to be? [thumbnail drawInRect:projectRect];
I listed out all my question using comments in the code. Please explain thanks.