<legend id='tuyZc'><style id='tuyZc'><dir id='tuyZc'><q id='tuyZc'></q></dir></style></legend>
    <i id='tuyZc'><tr id='tuyZc'><dt id='tuyZc'><q id='tuyZc'><span id='tuyZc'><b id='tuyZc'><form id='tuyZc'><ins id='tuyZc'></ins><ul id='tuyZc'></ul><sub id='tuyZc'></sub></form><legend id='tuyZc'></legend><bdo id='tuyZc'><pre id='tuyZc'><center id='tuyZc'></center></pre></bdo></b><th id='tuyZc'></th></span></q></dt></tr></i><div id='tuyZc'><tfoot id='tuyZc'></tfoot><dl id='tuyZc'><fieldset id='tuyZc'></fieldset></dl></div>
  1. <tfoot id='tuyZc'></tfoot>
        <bdo id='tuyZc'></bdo><ul id='tuyZc'></ul>

      <small id='tuyZc'></small><noframes id='tuyZc'>

    1. 如何在 iPhone 上旋转 Quartz 绘制的文字

      How to rotate text drawn by Quartz on iPhone(如何在 iPhone 上旋转 Quartz 绘制的文字)

          <tbody id='R35eH'></tbody>
        <tfoot id='R35eH'></tfoot>
        <legend id='R35eH'><style id='R35eH'><dir id='R35eH'><q id='R35eH'></q></dir></style></legend>

          1. <small id='R35eH'></small><noframes id='R35eH'>

              <i id='R35eH'><tr id='R35eH'><dt id='R35eH'><q id='R35eH'><span id='R35eH'><b id='R35eH'><form id='R35eH'><ins id='R35eH'></ins><ul id='R35eH'></ul><sub id='R35eH'></sub></form><legend id='R35eH'></legend><bdo id='R35eH'><pre id='R35eH'><center id='R35eH'></center></pre></bdo></b><th id='R35eH'></th></span></q></dt></tr></i><div id='R35eH'><tfoot id='R35eH'></tfoot><dl id='R35eH'><fieldset id='R35eH'></fieldset></dl></div>
                <bdo id='R35eH'></bdo><ul id='R35eH'></ul>
              • 本文介绍了如何在 iPhone 上旋转 Quartz 绘制的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我想用 Quartz 画一些文字.现在应用程序绘制,但我希望它显示为0123456789".有什么方法可以显示它的正常方向吗?

                I want to draw some texts using Quartz. Now the app draws , but I want it to show as "0123456789". Is there any way to show its normal orientation?

                这是我的代码:

                    //set image view
                 drawImage = [[UIImageView alloc] initWithImage:nil];
                 drawImage.frame = self.view.frame;
                 [self.view addSubview:drawImage];
                
                 UIGraphicsBeginImageContext(self.view.frame.size);  // begin
                 // current context
                 CGContextRef context = UIGraphicsGetCurrentContext();
                
                 CGContextSelectFont(context, "Courier", 40,  kCGEncodingMacRoman);
                 CGFloat white[] = {1.0, 1.0, 1.0, 1.0};
                 CGContextSetFillColor(context, white);
                 CGContextShowTextAtPoint(context, 0, 30, "0123456789", strlen("0123456789"));
                
                 // get image
                 drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
                 UIGraphicsEndImageContext();    // end
                

                推荐答案

                在 Quartz 中,由于 Y 轴倒置,图像会上下颠倒.

                In Quartz, the image will be upside down because its Y-Axis is inverted.

                iPhone 的 Y 轴从上到下为正,即原点位于左上角,而在 Quartz 和 OpenGL 中,坐标与良好的旧几何图形相同,即原点位于左下角.

                iPhone's Y axis goes positive from top to bottom i.e. origin is at top left while in Quartz and OpenGL, the co-ordinates are the same way as good old geometry i.e. origin at bottom left.

                这里是一些解决 Quartz 反演问题的代码:

                Here is some code for solving Quartz inversion problem:

                CGContextRef ctx = UIGraphicsGetCurrentContext();
                // Tanslate and scale upside-down to compensate for Quartz's inverted coordinate system
                CGContextTranslateCTM(ctx, 0.0, rect.size.height);
                CGContextScaleCTM(ctx, 1.0, -1.0);
                

                这是一篇有趣的文章,作者说新加坡的一个团队因为这个他们无法弄清楚的反转问题而放弃了一个 iPhone 项目:http://trandangkhoa.blogspot.com/2009/07/iphone-os-drawing-image-and-stupid.html

                Here is an interesting post about it where the author says a team in Singapore gave up an iPhone project due to this inversion problem which they could not figure out: http://trandangkhoa.blogspot.com/2009/07/iphone-os-drawing-image-and-stupid.html

                这篇关于如何在 iPhone 上旋转 Quartz 绘制的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
                UIImageView Gestures (Zoom, Rotate) Question(UIImageView 手势(缩放、旋转)问题)
                Responsive website on iPhone - unwanted white space on rotate from landscape to portrait(iPhone上的响应式网站-从横向旋转到纵向时不需要的空白)
                How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
                How to capture current view screenshot and reuse in code? (iPhone SDK)(如何捕获当前视图屏幕截图并在代码中重用?(iPhone SDK))
                iOS 6 shouldAutorotate: is NOT being called(iOS 6 shouldAutorotate: 没有被调用)

                <small id='TCzka'></small><noframes id='TCzka'>

                <legend id='TCzka'><style id='TCzka'><dir id='TCzka'><q id='TCzka'></q></dir></style></legend>

                      • <bdo id='TCzka'></bdo><ul id='TCzka'></ul>
                      • <i id='TCzka'><tr id='TCzka'><dt id='TCzka'><q id='TCzka'><span id='TCzka'><b id='TCzka'><form id='TCzka'><ins id='TCzka'></ins><ul id='TCzka'></ul><sub id='TCzka'></sub></form><legend id='TCzka'></legend><bdo id='TCzka'><pre id='TCzka'><center id='TCzka'></center></pre></bdo></b><th id='TCzka'></th></span></q></dt></tr></i><div id='TCzka'><tfoot id='TCzka'></tfoot><dl id='TCzka'><fieldset id='TCzka'></fieldset></dl></div>
                        • <tfoot id='TCzka'></tfoot>
                            <tbody id='TCzka'></tbody>