Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!CGRectIsNull(rectIntersection)) {
- CGRect newFrame = CGRectOffset (rectIntersection, 0, -2);
- [backgroundView setFrame:newFrame];
- } else{
- [viewsUpdater invalidate];
- viewsUpdater = nil;
- }
- CGRect mainViewFrame = [mainView frame];
- if (!CGRectContainsRect(mainViewFrame, backgroundFrame)) {
- CGRect newMainViewFrame = CGRectMake(0,
- 0,
- mainViewFrame.size.width,
- (mainViewFrame.size.height + 2));
- [mainView setFrame:newMainViewFrame];
- }
- if (!CGRectIsNull(rectIntersection)) {
- // here you set the wrong frame
- //CGRect newFrame = CGRectOffset (rectIntersection, 0, -2);
- CGRect newFrame = CGRectOffset (backgroundView.frame, 0, -2);
- [backgroundView setFrame:newFrame];
- } else{
- [viewsUpdater invalidate];
- viewsUpdater = nil;
- }
- // eventually a control action method, pass nil for direct call
- -(void)performBackgroundViewAnimation:(id)sender {
- // first, double the mainView's frame height
- CGFrame newFrame = CGRectMake(mainView.frame.origin.x,
- mainView.frame.origin.y,
- mainView.frame.size.width,
- mainView.frame.size.height*2);
- // then get the backgroundView's destination rect
- CGFrame newBVFrame = CGRectOffset(backgroundView.frame,
- 0,
- -(backgroundView.frame.size.height));
- // run the animation
- [UIView animateWithDuration:1.0
- animations:^{
- mainView.frame = newFrame;
- backgroundView.frame = newBVFrame;
- }
- ];
- }
Add Comment
Please, Sign In to add comment