我正在尝试将 CGFloat 与整数值进行比较。基于这个值,执行一个有条件的......非常标准。但是,出于某种原因,这将始终是正确的。我什至打印出这些值,它们显然小于 800....纯粹基于它的二进制值,所以我尝试了这个有风险的小演员操作......有什么想法吗?
CGPoint textViewPoint = [scroller convertPoint:[textView center] toView:(UIView *)self.view];
NSLog(@"the y coord is %f", textViewPoint.y);
int size = (int)textViewPoint.y;
NSLog(@"the yint %d", size);
//move the main view, so that the keyboard does not hide it.
//if (self.scroller.frame.origin.y >= 0 && textViewPoint.y > 800.0);
if(size > 800);
{
NSLog(@"moving up");