權的問題交換意見,我知道怎麼做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