今天写一个iOS的插件,高度总是出问题,检查语句感觉没有什么问题。
CGFloat height = [Adaptation4iOS iPhoneScreenContent].height- [SystemUtils isIos7]?20:0- _realSearchBar.frame.size.height;
但是返回的高度总不是计算所需要的高度举个明确的例子
BOOL isThree = YES;
CGFloat height = 100 - isThree?20:0- 44;
//it's return 20 , why?
height = 100-(isThee?20:0)-44;
//But , add parentheses,it's return 36 , it's clear , ‘?’priority is higher than '='