參考: http://www.cnblogs.com/minglz/archive/2012/12/11/2809368.html
一個view 用兩個xib 文件的代碼實例:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { YourViewController *vc = [[[YourViewController alloc] initWithNibName:@"YourViewController_iPhone " bundle:nil] autorelease]; //加載iphone 的界面 } else { YourViewController *vc = [[[YourViewController alloc] initWithNibName:@"YourViewController_iPad" bundle:nil] autorelease]; //加載ipad的界面 }
知識點:
point在非retina屏幕中是20px,在retina屏幕中是40px
iphone4屏幕的大小是320*480 point 如果是普通屏幕,則其像素是 320*480,retina 屏幕是 640*960 px