CGRectIntersection gives wrong frame

108 Views Asked by At

I am using CGRectIntersection to get the common visible frame availbale from subview UIView.I have an uiview shown as pullup view on screen(say screen1),where uiview(pullUpView) is added as subview to screen1.When anyone presses button on screen1 it slides up pullUpView partially.So to get the frame of partially visible view I am using:

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

After getting visible_frame I am adding UIButton at the bottom of visible_frame like this

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

But it adds button approximately 50 pixel above than the desired bottom of visible_frame.

What is wrong in above calculation can anybody please point out.

0

There are 0 best solutions below