今天写一个iOS的插件,高度总是出问题,检查语句感觉没有什么问题。
|
1 |
CGFloat height = [Adaptation4iOS iPhoneScreenContent].height- [SystemUtils isIos7]?20:0- _realSearchBar.frame.size.height; |
但是返回的高度总不是计算所需要的高度举个明确的例子
|
1
2
3
4
5
6
7 |
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 ‘=‘ |
原文地址:http://www.cnblogs.com/littleplayer/p/3704271.html