CGContextTranslateCTM
畫布的大小由 UIGraphicsBeginImageContextWithOptions
的參數 size
決定,總是記不住這一點。code
UIGraphicsBeginImageContextWithOptions(size, YES, 0); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0, size.height); CGContextScaleCTM(context, 1, -1);