我有一個if else語句,並有2個完全正確的參數在裏面,但是第二個,如果給我這樣的警告:邏輯和位運算符警告困惑 - iOS設備
與使用的邏輯「& &」恆定的操作數
使用的代碼是:
else if (!IS_WIDESCREEN && UIInterfaceOrientationPortrait) //No Warning or error
{
}
else if(IS_WIDESCREEN && UIInterfaceOrientationLandscapeRight) //Gives me the above warning
{
}
注:IS_WIDESCREEN - 定義瓦特ith針對iPhone 5屏幕的測量。
任何想法,爲什麼這是??
///編輯:
加我如何定義的iPhone 5
#define IS_WIDESCREEN (fabs((double)[ [ UIScreen mainScreen ] bounds ].size.height - (double)568) < DBL_EPSILON)
整個事情是這樣的方法中:
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
當你說這與三圍爲iPhone 5的屏幕定義你的意思是它只是硬編碼到大小或者是在其定義的另一個邏輯檢查? – rooster117
爲你添加了代碼,所以你可以看到我做了什麼 –
這是在'shouldAutoRotateToInterfaceOrientation'方法中嗎? – aqua