코딩하는 나귀

[출처 : http://krazyeom.tistory.com]

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";
            }
        }
    }