您的位置:首页 > 产品设计 > UI/UE

ios 自定义UIView绘制时文字上下颠倒问题解决

2014-01-10 13:07 477 查看
- (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
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: