Detects that the current device is an iPhone

Source: Internet
Author: User

 If([[Uidevice
Currentdevice]Userinterfaceidiom] =
Uiuserinterfaceidiomphone)

Sdks 3.2 later

Uiuserinterfaceidiomphone,// IPhone and iPod Touch style UI

Uiuserinterfaceidiompad,// IPad style UI

I just read the SDK:

@ Property(Nonatomic,Readonly,Retain)Nsstring* Model;// E.g. @ "iPhone ",
@ "IPod Touch"

This attribute can also be used.

Nsstring * devicetype = [uidevice currentdevice]. model;

You can also get the desired result.

Try it ~. No problem.

Or

You can use the screen size to check whether the iPhone or iPad is used.

Summary: there are at least three methods:

1.[[Uidevice Currentdevice]
Userinterfaceidiom] =Uiuserinterfaceidiomphone

2. [uidevice currentdevice]. Model

3. [ uiscreen
mainscreen ]
applicationframe ];

if you have other good solutions, please let us know.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.