怎么知道是iphone还是ipad? [英] how to know is it iphone or ipad?

查看:97
本文介绍了怎么知道是iphone还是ipad?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道用户使用iphone或ipad,如果用户使用iphone我想打开相机,如果他使用ipad或在模拟器中运行我想打开库。怎么可能?
如何查找设备的详细信息?
如何通过xcode知道当前使用设备的用户?

i want to know the user uses the iphone or ipad,if the user uses the iphone i want to open the camera,if he uses the ipad or runs in simulator i want to open the library. how it is possible? how to find the details of devices? how to know current using device by user through xcode?

推荐答案

你不应该确定是否有摄像头看着模特。这不是未来的证明 - 例如,你不会支持iPad 2的相机。

You should not determine whether there is a camera by looking at the model. This is not future proof - for instance, you would not be supporting the iPad 2's camera.

UIImagePickerController有一个特殊的方法来确定相机是否可用:

UIImagePickerController has a special method to determine whether a camera in available:

+ (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType

sourceType为

With sourceType being one of

UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum

这篇关于怎么知道是iphone还是ipad?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆