你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> 如何判斷 ios設備的類型(iphone,ipod,ipad)

如何判斷 ios設備的類型(iphone,ipod,ipad)

編輯:IOS開發綜合
-(bool)checkDevice:(NSString*)name
{
	NSString* deviceType = [UIDevice currentDevice].model;
	NSLog(@"deviceType = %@", deviceType);
	
	NSRange range = [deviceType rangeOfString:name];
	return range.location != NSNotFound;
}



		NSString *  nsStrIphone=@"iPhone";
		NSString *  nsStrIpod=@"iPod";
		NSString *  nsStrIpad=@"iPad";
		bool  bIsiPhone=false;
		bool  bIsiPod=false;
		bool  bIsiPad=false;
		bIsiPhone=[self  checkDevice:nsStrIphone];
		bIsiPod=[self checkDevice:nsStrIpod];
		bIsiPad=[self checkDevice:nsStrIpad];


  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved