how to know is it iphone or ipad?

后端 未结 5 886
北荒
北荒 2021-01-06 07:35

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. ho

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-06 07:45

    NSString *deviceType = [UIDevice currentDevice].model;
    
    if([deviceType isEqualToString:@"iPhone"])
    {
         //your code
    }
    .....
    

    Hope this helps.

    EDIT:

    See this thread -determine-device-iphone-ipod-touch-with-iphone-sdk .

提交回复
热议问题