项目介绍:
[qq]85940969[/qq]
拍照、选取相册图片更换头像,选择图片主要代码如下:
[Objective-C] 查看源文件 复制代码
@IBOutlet weak var b_change: UIButton! //选择头像操作 @IBAction func changeIcon(sender: AnyObject) { let userIconAlert = UIAlertController(title: "请选择操作", message: "", preferredStyle: UIAlertControllerStyle.ActionSheet) let chooseFromPhotoAlbum = UIAlertAction(title: "从相册选择", style: UIAlertActionStyle.Default, handler: funcChooseFromPhotoAlbum) userIconAlert.addAction(chooseFromPhotoAlbum) let chooseFromCamera = UIAlertAction(title: "拍照", style: UIAlertActionStyle.Default,handler:funcChooseFromCamera) userIconAlert.addAction(chooseFromCamera) let canelAction = UIAlertAction(title: "取消", style: UIAlertActionStyle.Cancel,handler: nil) userIconAlert.addAction(canelAction) self.presentViewController(userIconAlert, animated: true, completion: nil) } override func viewDidLoad() { super.viewDidLoad() b_change.layer.masksToBounds = true b_change.layer.cornerRadius = b_change.frame.width/2 // Do any additional setup after loading the view, typically from a nib. }
UIImagePickerControllerDemo.zip
(90.66 KB, 下载次数: 401, 售价: 5 金钱)
2016-7-12 14:53 上传
点击文件名下载附件