.
, :
"" , , ( , , , ).
, , , , "shouldAutorotateToInterfaceOrientation: True" vc. , , .
, :
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
view1 = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
[view1 setBackgroundColor:[UIColor greenColor]];
[view1 setFont:[UIFont systemFontOfSize:80]];
[view1 setText:@"VIEW 1"];
view2 = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
[view2 setBackgroundColor:[UIColor redColor]];
[view2 setFont:[UIFont systemFontOfSize:80]];
[view2 setText:@"VIEW 2"];
}
return self;
}
-(void)didSwipeNext
{
[self performSelector:@selector(swipePrevious) withObject:nil afterDelay:1];
}
-(void)didSwipePrevious
{
[self performSelector:@selector(swipeNext) withObject:nil afterDelay:1];
}
-(void)swipeNext
{
[UIView beginAnimations:@"curl" context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationDidStopSelector:@selector(didSwipeNext)];
[view1 removeFromSuperview];
[self.view addSubview:view2];
[UIView commitAnimations];
}
-(void)swipePrevious
{
[UIView beginAnimations:@"curl" context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationDidStopSelector:@selector(didSwipePrevious)];
[view2 removeFromSuperview];
[self.view addSubview:view1];
[UIView commitAnimations];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:view1];
[self performSelector:@selector(swipeNext) withObject:nil afterDelay:1];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}