ios中调用摄像头
@interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(, , , );
[button setTitle:@"aa" forState:UIControlStateNormal];
[button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
} -(void)click:(UIButton *)btn{ UIImagePickerController *imagePicker=[[UIImagePickerController alloc] init];
imagePicker.delegate=self;
// imagePicker.view.frame=s
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera; }
// imagePicker.allowsEditing=YES;
// [self.view addSubview:imagePicker.view];
[self presentViewController:imagePicker animated:YES completion:^{ }];
} - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { }
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(@"%@",info);
UIImage *image=[info objectForKey:UIImagePickerControllerOriginalImage]; self.image.image=image;
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
[self dismissViewControllerAnimated:YES completion:^{ }];
}
参照文章http://my.oschina.net/CarlHuang/blog/139997
http://my.oschina.net/chen106106/blog/48853
ios中调用摄像头的更多相关文章
- html5中调用摄像头拍照
方法: getCamera: 获取摄像头管理对象 对象: Camera: 摄像头对象 CameraOption: JSON对象.调用摄像头的參数 PopPosition: JSON对象,弹出拍照或摄像 ...
- IOS中调用系统的电话、短信、邮件、浏览功能
iOS开发系列--通讯录.蓝牙.内购.GameCenter.iCloud.Passbook系统服务开发汇总 2015-01-13 09:16 by KenshinCui, 26990 阅读, 35 评 ...
- 【MediaKit】WPF项目中 调用摄像头拍照的开发包
今天遇到一个 人事的项目,项目中需要调用摄像头给员工照相.如何解决这个问题呢? 介绍一个开发包给你,MediaKit.论坛里头的人都说好,但是黑兔觉得大家好才是真的好.你不妨试试~ 第一步:添加WPF ...
- ios中调用WCF
例子比较简单 记录下思路 1.接口中定义 实体和方法声明 //登录信息 [OperationContract] [WebInvoke(UriTemplate = " ...
- iOS中调用系统录音功能及其播放
最近做的项目中,用到了录音的功能,简单记录一下. 我的想法是:通过重写button的点击事件,来达到录音的目的. /*----------------------------------[录音]--- ...
- IOS中调用系统拨打电话发送短信
一.调用打电话界面 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat ...
- ios中调用友盟分享时qq可以分享但是微信失败,只显示文字,网页链接没有出现
问题如下,最后在老大各种替换的情况下,找到了原因,是因为图片失效了,友盟分享微信时必须需要图片才可以,如果服务器图片失效,则会失败: 注意下面的图片是否能够获取???????????????????? ...
- Unity在Android和iOS中如何调用Native API
本文主要是对unity中如何在Android和iOS中调用Native API进行介绍. 首先unity支持在C#中调用C++ dll,这样可以在Android和iOS中提供C++接口在unity中调 ...
- android ——调用摄像头拍照和相册
先在布局文件中加入两个按钮和一个图片控件 <?xml version="1.0" encoding="utf-8"?> <LinearLayo ...
随机推荐
- Openfire XMPP Smack RTC IM 即时通讯 聊天 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- spring boot整合mybatis+mybatis-plus
Spring boot对于我来说是一个刚接触的新东西,学习过程中,发现这东西还是很容易上手的,Spring boot没配置时会默认使用Spring data jpa,这东西可以说一个极简洁的工具,可是 ...
- 解决Android中图片圆角——.9图
目录: 一.问题概述 二..9图介绍 三..9图制作 1.开发工具 2.打开图片 3.制作图片 4.保存图片 一.问题概述 在html开发中,可以通过设置css的border-radius来设置圆角 ...
- 在centos7.4上安装mysql5.5
from: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7
- Objective-C 简介
很少有人会想到 Objective-C 历史悠久,并且它实际上影响了很多其他的编程技术.比如, Java 编程语言和 Objective-C 就有很多共同点.原因就是在 Objective-C 的早期 ...
- Dubbo-Fail to decode request due to: RpcInvocation
使用Dubbo进行服务化,遇到如下错误: Caused by: com.alibaba.dubbo.remoting.RemotingException: Fail to decode request ...
- ExtJS学习笔记2:响应事件、使用AJAX载入数据
响应事件: 1.设置一个html标记 <div id="my-div">Ext JS 4 Cookbook</div> 2.使用get函数获取此标记对象 v ...
- Android Context完全解析,你所不知道的Context的各种细节
Context相信所有的Android开发人员基本上每天都在接触,因为它太常见了.但是这并不代表Context没有什么东西好讲的,实际上Context有太多小的细节并不被大家所关注,那么今天我们就来学 ...
- LeetCode Linked List Cycle II 和I 通用算法和优化算法
Linked List Cycle II Given a linked list, return the node where the cycle begins. If there is no cyc ...
- pynput使用简单说明
控制鼠标 from pynput.mouse import Button, Controller import time mouse = Controller() print(mouse.positi ...