第一种方法
if ([[UIDevice currentDevice].model rangeOfString:@"iPod"].location != NSNotFound) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提升"
message:@"该设备不支持此功能"
delegate:nil
cancelButtonTitle:@"确定"
otherButtonTitles: nil];
[alert show];
[alert release];
return;
}
第二张方法:此方法使用系统宏,但是无法区别iPhone和touch(ipod)
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提升"
message:@"该设备不支持此功能1"
delegate:nil
cancelButtonTitle:@"确定"
otherButtonTitles: nil];
[alert show];
[alert release];
return;
}