权的问题交换意见,我知道怎么做pictue书效应,但我在努力去除视图iPhone:就像一本图画书,与removeFromSuperView
所以第1页,我添加了通过addSubview第二页视图(通过一个滑动)。我还增加了一个柜台,所以我知道我在哪个页面上。
那么如何返回到第1页?见我认为这将是self.view removeFromSuperview但是当你试图返回到第2页
代码如下
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer {
if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
//NSLog(@"swipe right to left");
UniversalAppAppDelegate *appDelegate = (UniversalAppAppDelegate *)[[UIApplication sharedApplication] delegate];
PictureBookViewController *viewController2 =(PictureBookViewController *) [appDelegate getViewControllerForViewID:@"81"];
[UIView beginAnimations:Nil context:nil];
[UIView setAnimationDuration:0.6];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view.superview cache:YES];
self.viewController = viewController2;
self.viewController.pageNo = self.pageNo + 1;
[self.view addSubview:self.viewController.view];
[UIView commitAnimations];
[viewController2 release];
} else {
//NSLog(@"swipe left to right");
NSLog([NSString stringWithFormat:@"%d", self.pageNo]);
if (self.pageNo > 0) {
[UIView beginAnimations:Nil context:nil];
[UIView setAnimationDuration:0.6];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view.superview cache:YES];
//self.viewController = viewController2;
//self.viewController.pageNo = self.pageNo - 1;
//[self.view addSubview:self.viewController.view];
[self.view removeFromSuperview];
//[self.view addSubview:self.viewController.view];
[UIView commitAnimations];
}
}
}
更新的崩溃:
每个视图都有自己的看法控制器。
你能否正确地格式化你的代码? – 2010-09-23 11:25:30
对不起,对不起 – Burf2000 2010-09-23 11:28:38