iPod touch인지 iPhone 인지 구분하기
iOS2010. 1. 22. 11:47
[출처 : http://krazyeom.tistory.com]
enum
enum
{
MODEL_IPHONE_SIMULATOR,
MODEL_IPOD_TOUCH,
MODEL_IPHONE,
MODEL_IPHONE_3G
};
UIDevice *currentDevice = [UIDevice currentDevice]; // 무슨 기기인지??? 이거 한줄이면 되죠.
NSString *iPodTouch = @"iPod touch";
NSString *iPhoneSimulator = @"iPhone Simulator";
NSString *model= [currentDevice model];
NSString *detected;
if ( [model compare:iPhoneSimulator] == NSOrderedSame ) // iPhone simulator
{
detected = @"home_touch.png";
}
else if ( [model compare:iPodTouch] == NSOrderedSame ) // iPod Touch
{
detected = @"home_touch.png";
}
else // Could be an iPhone V1 or iPhone 3G (model should be "iPhone")
{
// Detect if we are running on an iPhone 3G
{
struct utsname u;
uname( &u ); // u.machine could be "i386" for the
simulator, "iPod1,1" on iPod Touch, "iPhone1,1" on iPhone V1 &
"iPhone1,2" on iPhone3G
if ( !strcmp( u.machine, "iPhone1,1" ) )
{
detected = @"home_iphone.png";
}
else
{
detected = @"home_iphone.png";
}
}
}
'iOS' 카테고리의 다른 글
[iOS] 이미지 합치기(Image Merge) (0) | 2011.07.01 |
---|---|
[iOS] NSString Encoding (0) | 2011.07.01 |
[iOS] NSString(문자열) 클래스 이름으로 부터 해당 클래스 객체 생성하기 (0) | 2011.03.09 |
[iOS] 로그(NSLog) 기록 (0) | 2011.01.17 |
[아이폰] "누구니?" 두둥! 최초 유료어플 등록 (0) | 2010.04.16 |
[아이폰] 깊은 뮤터블 복사(mutableCopy) (5) | 2010.01.27 |
[아이폰] 인터넷 연결 확인 (0) | 2010.01.22 |
날짜(NSDate)를 원하는 포멧의 문자형태(NSString)로 받기 (0) | 2010.01.22 |
View의 이동에 애니메이션 효과 주기 (0) | 2010.01.22 |
로딩이미지(Default.png) 애니메이션 주기 (1) | 2010.01.22 |