---
title: "How does one get UI_USER_INTERFACE_IDIOM() to work with iPhone OS SDK < 3.2"
author: "wanggp"
date: "2011-05-17T15:31:51Z"
tags: []
categories: ["移动开发"]
slug: "how-does-one-get-ui-user-interface-idiom-to-work-with-iphone-os-sdk-3-2"
draft: false
lastmod: "2011-05-17T15:31:51Z"
id: 1047109
url: "https://wanggp.iteye.com/blog/1047109"
---

```
BOOL iPad = NO;
#ifdef UI_USER_INTERFACE_IDIOM
iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#endif
if (iPad) {
// iPad specific code here
} else {
// iPhone/iPod specific code here
}
```