照片选择

     // MARK: - 选择照片
     /*----- 选择照片 ------*/
     @IBAction func addImageButtonClick()
     {
         let actionSheet = UIActionSheet(title: "请选择", delegate: self, cancelButtonTitle: "取消", destructiveButtonTitle: nil, otherButtonTitles: "从相册选","拍照")
         actionSheet.showInView(self.view)
     }

     // MARK: - 选取相册
     func fromAlbum()
     {
         //判断设置是否支持图片库
         if UIImagePickerController.isSourceTypeAvailable(.PhotoLibrary)
         {
             //初始化图片控制器
             let picker = UIImagePickerController()

             //设置代理
             picker.delegate = self

             //设置媒体类型
             picker.mediaTypes = [kUTTypeImage,kUTTypeVideo]

             //设置允许编辑
             picker.allowsEditing = true;

             //指定图片控制器类型
             picker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary

             //弹出控制器,显示界面
             self.presentViewController(picker, animated: true, completion: { () -> Void in

             })

         }
         else
         {
             let aler = UIAlertView(title: "读取相册错误!", message: nil, delegate: nil, cancelButtonTitle: "确定")
             aler.show()
         }
     }
 

ios开发——实用技术篇Swift篇&照片选择的更多相关文章

  1. ios开发——实用技术篇Swift篇&播放MP3

    播放MP3 // MARK: - 播放MP3 /*----- mp3 ------*/ //定时器- func updateTime() { //获取音频播放器播放的进度,单位秒 var cuTime ...

  2. ios开发——实用技术篇Swift篇&拍照

    拍照 // MARK: - 拍照 func fromPhotograph() { if UIImagePickerController.isSourceTypeAvailable(.Camera) { ...

  3. ios开发——实用技术篇Swift篇&地址薄、短信、邮件

    //返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControllerAnimated(tru ...

  4. ios开发——实用技术篇Swift篇&系统声音

    系统声音 // MARK: - 系统声音 /*----- 系统声音 ------*/ @IBAction func systemSound() { //建立的SystemSoundID对象 var s ...

  5. ios开发——实用技术篇Swift篇&视频

    视频 // MARK: - 播放视频 /*----- 播放视频 ------*/ func moviePlayerPreloadFinish(notification:NSNotification) ...

  6. ios开发——实用技术篇Swift篇&录音

    录音 // MARK: - 录音 /*----- 录音 ------*/ var recorder:AVAudioRecorder? //录音器 var player:AVAudioPlayer? / ...

  7. ios开发——实用技术篇Swift篇&加速计和陀螺仪

    加速计和陀螺仪 //返回按钮事件 @IBAction func backButtonClick() { self.navigationController?.popViewControllerAnim ...

  8. ios开发——实用技术篇Swift篇&多点触摸与手势识别

    多点触摸与手势识别 //点击事件 var atap = UITapGestureRecognizer(target: self, action: "tapDo:") self.vi ...

  9. ios开发——实用技术篇OC篇&iOS的主要框架

    iOS的主要框架         阅读目录 Foundation框架为所有的应用程序提供基本系统服务 UIKit框架提供创建基于触摸用户界面的类 Core Data框架管着理应用程序数据模型 Core ...

随机推荐

  1. 关于Activity的少许细节

    1.  对活动应用样式和主题 2.  隐藏活动标题 3. 显示对话框窗口 4. 显示进度对话框 1.  应用样式和主题 改成 android:theme="@android:style/Th ...

  2. Leetcode 210 Course Schedule II

    here are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prere ...

  3. java多线程之Lock线程同步

    1.线程同步: package cn.itcast.heima2; import java.util.concurrent.locks.Lock; import java.util.concurren ...

  4. dom 冒泡事件

    <!doctype html> <html> <head> <meta charset="utf-8"> <style> ...

  5. LAMP最新源码一键安装脚本

    Linux+Apache+MySQL+PHP (脚本可以选择是否安装+Pureftpd+User manager for PureFTPd+phpMyAdmin+memcache),添加虚拟主机请执行 ...

  6. nyoj117 求逆序数

    求逆序数 时间限制:2000 ms  |  内存限制:65535 KB 难度:5   描述 在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序.一个排列中 ...

  7. windows XP系统内核文件分析(全)

    Windows XP个别 System32 文件 System32 文件夹下个别要移除的文件 我们就要删除另外600 个 system32 文件...我们要一次把它们全都解决掉. 以下是我所删除的 S ...

  8. (高精度运算4.7.21)UVA 10106 Product(大数乘法)

    package com.njupt.acm; import java.math.BigInteger; import java.util.Scanner; public class UVA_10106 ...

  9. 利用一些码农Trick去搞一搞G和T的单词

    根据自然语言处理中的Zipf统计定律,在自然语言的语料库里,一个单词出现的频率与它在频率表里的排名成反比.因此,我们有理由认为,可以根据这个频率表进行一下排序,以及purning.由于精力有限,没有足 ...

  10. Rank() over(partition ... 分组统计的实例

    USE [NanFeng]GO/****** Object: StoredProcedure [dbo].[st_MES_RptMaterilSum] Script Date: 04/18/2016 ...