CGRectIntersection给出了错误的框架

时间:2016-03-15 06:53:37

标签: ios objective-c uiview uibutton cgrectintersectsrect

我正在使用CGRectIntersection从子视图UIView获取常见的可见帧availbale。我有一个uiview显示为屏幕上的上拉视图(比如screen1),其中uiview(pullUpView)作为子视图添加到screen1.When任何人按下按钮screen1它向上滑动pullUpView.So以获取我正在使用的部分可见视图的框架:

CGRect visible_frame = CGRectIntersection(pullUpView.frame,screen1.bounds).

获取visible_frame后,我会在visible_frame的底部添加UIButton,就像这样

CGFloat y_pos = visibleFrame.size.height ;
UIButton * button = [[UIButton alloc]initWithframe:CGRectMake(x,y_pos,visible_frame.size.width),30];

但它添加了比visible_frame所需底部大约50像素的按钮。

上述计算有什么问题可以请任何人指出。

0 个答案:

没有答案