我的动画目前动画我的新视图从底部进入。我宁愿让它做一个水平翻转。
如何编辑我的代码才能生成此代码?感谢。
-(void) aboutButtonPressed
{
[aboutView setFrame:CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:aboutView];
[UIView animateWithDuration:.5 animations:^{
[aboutView setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
}];
}
更新
@interface AboutViewController : UIViewController {
NSMutableArray *array1;
NSMutableArray *array2;
}
@property (nonatomic, retain) IBOutlet UITableView *aboutTableView;
@property (nonatomic, retain) IBOutlet UINavigationBar *navBar;
@property (nonatomic, retain) IBOutlet UIBarButtonItem *doneButton;
@property (nonatomic, retain) NSArray *array1;
@property (nonatomic, retain) NSArray *array2;
答案 0 :(得分:1)
我认为您想要的翻转动画来自presentModalViewController:animated:
,可以在UIViewController Documentation
您想要的是将aboutView转换为AboutViewController:
-(void) aboutButtonPressed
{
AboutViewController *viewController = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
viewController.delegate = self;
[self presentModalViewController:viewController animated:YES];
[viewController release];
}
答案 1 :(得分:1)
使用方法:
[UIView animateWithDuration:delay:options:animations:completion:]
例如:
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[aboutView setFrame:CGRectMake(0, 0, self.view.frame.size.width,
self.view.frame.size.height)];
}
completion:nil]
更多关于UIView文档的内容:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html