<tfoot id='dwO6C'></tfoot>

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

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

        如何在 iOS 中裁剪图像

        时间:2023-10-23
        <i id='7ngBa'><tr id='7ngBa'><dt id='7ngBa'><q id='7ngBa'><span id='7ngBa'><b id='7ngBa'><form id='7ngBa'><ins id='7ngBa'></ins><ul id='7ngBa'></ul><sub id='7ngBa'></sub></form><legend id='7ngBa'></legend><bdo id='7ngBa'><pre id='7ngBa'><center id='7ngBa'></center></pre></bdo></b><th id='7ngBa'></th></span></q></dt></tr></i><div id='7ngBa'><tfoot id='7ngBa'></tfoot><dl id='7ngBa'><fieldset id='7ngBa'></fieldset></dl></div>

          <bdo id='7ngBa'></bdo><ul id='7ngBa'></ul>
            <tbody id='7ngBa'></tbody>

          <small id='7ngBa'></small><noframes id='7ngBa'>

          <tfoot id='7ngBa'></tfoot>

                <legend id='7ngBa'><style id='7ngBa'><dir id='7ngBa'><q id='7ngBa'></q></dir></style></legend>
                • 本文介绍了如何在 iOS 中裁剪图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个照片应用程序,您可以在其中在一个部分中添加贴纸.完成后,我想保存图像.这是我必须这样做的代码.

                  I have a photo app where you can add stickers in one section. When you're finished I want to save the image. Here is the code that I have to do that.

                  if(UIGraphicsBeginImageContextWithOptions != NULL)
                  {
                      UIGraphicsBeginImageContextWithOptions(self.view.frame.size, YES, 2.5);
                  } else {
                      UIGraphicsBeginImageContext(self.view.frame.size);
                  }
                  CGContextRef contextNew=UIGraphicsGetCurrentContext();
                  
                  [self.view.layer renderInContext:contextNew];
                  
                  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
                  
                  UIGraphicsEndImageContext();
                  

                  现在保存的图像是图像的全屏,这很好,但现在我需要裁剪图像,我不知道如何.您可以在下面的链接中看到图像:http://dl.dropbox.com/u/19130454/照片%202012-04-09%201%2036%2018%20PM.png

                  Now the image that gets saved is the full screen of the image, which is fine, but now I need to crop the image and I don't know how. You can see the image at the link below: http://dl.dropbox.com/u/19130454/Photo%202012-04-09%201%2036%2018%20PM.png

                  我需要裁剪:左右91px距离底部 220 像素

                  I need to crop: 91px from the left and right 220px from the bottom

                  任何帮助将不胜感激.如果我没有解释清楚,请告诉我,我会尽力重新解释.

                  Any help would be greatly appreciated. If I haven't explained things clearly, please let me know and I'll do my best to re-explain.

                  推荐答案

                  这样的怎么样

                  CGRect clippedRect  = CGRectMake(self.view.frame.origin.x+91, self.view.frame.origin.y, self.view.frame.size.width-91*2, self.view.frame.size.height-220);
                  CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], clippedRect);
                  UIImage *newImage   = [UIImage imageWithCGImage:imageRef];
                  CGImageRelease(imageRef);
                  

                  这篇关于如何在 iOS 中裁剪图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iPhone ios4 - 在播放背景音频流时替换 iPod 基座图标 下一篇:如何让 [UIImage imageWithContentsOfFile:] 和高分辨率图像工作

                  相关文章

                  <tfoot id='H7m0p'></tfoot>
                    <bdo id='H7m0p'></bdo><ul id='H7m0p'></ul>
                • <small id='H7m0p'></small><noframes id='H7m0p'>

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