Like facebook application if we want to apply slide animation in our application we don't need to add split view controller ,we can do that by simply add animation for perticuler view
first define kMenuListingOriginForPortrait and kMenuListingOriginForLandscape in .pch file
#define kMenuListingOriginForPortrait 768
#define kMenuListingOriginForLandscape 1024
first set listing screen x origin kMenuListingOriginForPortrait in portrait and kMenuListingOriginForLandscape in landscape mode then you can add on button and apply this method in that and via that method you can toggle[slide] your view
-(IBAction)toggleListing
{
[UIView beginAnimations:@"Menu Slide" context:nil];
[UIView setAnimationDuration:0.5];
CGRect newFrame;
if(self.vw_Listing.frame.origin.x == kMenuListingOriginForPortrait || self.vw_Listing.frame.origin.x == kMenuListingOriginForLandscape){
[self.vw_Listing setHidden:FALSE];
newFrame = CGRectOffset(self.vw_Listing.frame, -(self.vw_Listing.frame.size.width), 0.0);
self.vw_main.frame = CGRectMake(0, 0, self.vw_main.frame.size.width, self.vw_main.frame.size.height);
vw_Listing.frame = newFrame;
listingVisible = TRUE;
masterVisible = FALSE;
}
else{
newFrame = CGRectOffset(self.vw_main.frame, -(self.vw_Listing.frame.size.width), 0.0);
self.vw_main.frame = newFrame;
listingVisible = FALSE;
}
[UIView commitAnimations];
}
No comments:
Post a Comment