ios 自定义UIView绘制时文字上下颠倒问题解决
- (void)drawRect:(CGRect)rect
{
[self showPage:m_currentPageIndex];
}
- (void)showPage:(int)pageIndex
{
CGContextRef cntxRef = UIGraphicsGetCurrentContext();
CGPDFPageRef page = CGPDFDocumentGetPage (m_docRef, pageIndex);// 2
// Quartz画图得坐标系统是以左下角为开始点,但iphone视图是以左上角为开始点
CGContextTranslateCTM(cntxRef, 0, self.bounds.size.height);
//转变坐标系
CGContextScaleCTM(cntxRef, 1.0, -1);
CGContextDrawPDFPage (cntxRef, page);// 3
}