【问题标题】:Issue while trying to save an image to the camera roll SWIFT尝试将图像保存到相机胶卷 SWIFT 时出现问题
【发布时间】:2015-07-24 01:42:51
【问题描述】:

在尝试保存视图时遇到了一个奇怪的问题。 保存的图片裁剪掉了图片。

这里是代码:

    let scale = UIScreen.mainScreen().scale

    let size:CGSize = CGSize(width: CGFloat(self.customView!.frame.size.width), height:  CGFloat(self.customView!.frame.size.height))


    UIGraphicsBeginImageContextWithOptions( size, false, scale);

    self.customView!.layer.renderInContext(UIGraphicsGetCurrentContext())
    let screenshot = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()

    UIImageWriteToSavedPhotosAlbum(screenshot, nil, nil, nil)

请帮忙! 提前致谢

【问题讨论】:

    标签: ios swift xcode6.3 save-image


    【解决方案1】:

    相机胶卷具有自动缩放功能,因为高度比屏幕小了一点。

    【讨论】:

      猜你喜欢
      • 2012-06-25
      • 2022-01-01
      • 2015-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      相关资源
      最近更新 更多