0

我正在使用 CGRectIntersection 从子视图 UIView 获取公共可见框架可用。我有一个 uiview 在屏幕上显示为上拉视图(比如 screen1),其中 uiview(pullUpView)作为子视图添加到 screen1。当任何人按下 screen1 上的按钮时,它会滑动up pullUpView 部分。所以要获得我正在使用的部分可见视图的框架:

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 像素。

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

4

0 回答 0