Same xib for iPhone4 and iPhone5 possible?

前端 未结 8 638
不思量自难忘°
不思量自难忘° 2020-12-04 17:03

Is there any way I can design my classes for both iPhone4 and iPhone5 using the same xib?

8条回答
  •  青春惊慌失措
    2020-12-04 17:44

    Please define below line and check condition based on device.

    #define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
    
    if (IS_IPHONE_5) {
    
            btnBookmark.frame=CGRectMake(0, 460, 100, 70);
            btnBookmark.frame=CGRectMake(150, 460, 100, 70);
    
    
        }else{
            btnBookmark.frame=CGRectMake(0, 360, 100, 70);
            btnBookmark.frame=CGRectMake(150, 360, 100, 70);
    
    
        }
    

提交回复
热议问题