Swift Project 09 - ADD PHOTO FROM CAMERA ROLL
主要学习的内容:
- 了解学习 UIImagePickerController / UIImagePickerControllerDelegate
- iOS 10 新的隐私设定,不提前声明要访问隐私数据的话,App 直接 Crash
- Info.plist 中增加 NSPhotoLibraryUsageDescription 声明以便访问 Photo Library
- 学习了 NSMutableAttributedString 和 NSAttributedString
- 了解了如何简单处理 UIImage 图像
开发环境:
- macOS 10.12
- Xcode 8.0
- iOS 10.0
- Swift 3.0
组件:
- UIImagePickerController
- UIImagePickerControllerDelegate
- NSMutableAttributedString
- NSAttributedString
- UIImage
参考:
- Accessing the iOS 8 Camera and Photo Library in Swift
- HOW TO USE UIIMAGEPICKERCONTROLLER FOR A CAMERA AND PHOTO LIBRARY IN SWIFT 3.0
- Privacy Settings in iOS 10
- How to add images as text attachment in Swift using nsattributedstring
- iphone - how can i get the height and width of uiimage
源代码: