通过UIDevice().userInterfaceIdiom来判断是iPhone或者iPad,以此来执行不同的操作,或者为控件制定不同的frame
image.png
if UIDevice().userInterfaceIdiom == .Phone {
switch UIScreen.mainScreen().nativeBounds.height {
case 960:
productTitle.frame = CGRect(x: 7, y: 125, width:cell.frame.size.width-14, height: 23)
case 1136:
productTitle.frame = CGRect(x: 7, y: 125, width:cell.frame.size.width-14, height: 23)
default:
productTitle.frame = CGRect(x: 7, y: 178, width:cell.frame.size.width-14, height: 23)
}
}