We need to display a help menu or content of book which scrolls up on the view and show new view to the user.
Declare a BOOL to check view is hidden or not.
In .h
BOOL _isContentVisible;
UIView *_sideContentView;
-(IBAction)showHideContentView:(id)sender;
In .Xib
Connect the showHideContentView function to UIButton touchUpInside action.
In .m
-(void)showHideContentView:(id)sender
{
//BOOL isContentVisible= CGRectIntersectsRect(self.view.bounds, _sideContentScrollView.frame); // you can check view visibility if its scrollview.
[UIView animateWithDuration:1.0f
delay:0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
//hide if visible else show
if (_isContentVisible) { // Hide
_isContentVisible = NO;
[_sideContentView setFrame:CGRectMake(-360 +40, 0, 360, 748)];// 40 pixels is button to be seen on the view. Set the frame according to your choice.
}
else { // Show
_isContentVisible = YES;
[_sideContentView setFrame:CGRectMake(0, 0, 360, 748)];
}
}
completion:^(BOOL finished) {
if (finished) {
// Do any custom stuff on completion.
}
}];
}
No comments:
Post a Comment