我是新的 iphone 开发人员,我有 ipad 横向模式的 uiview 动画问题。我有两个 View view1(如 Split View)和 view2(覆盖的剩余窗口)。当我触摸从右移到左 view2 时,它将被覆盖带有移动动画的 view1。同时当我触摸从左到右移动 view2 来适应旧位置。请分享你的想法
问候, 拉杰什。
大家好,我终于找到答案了,
- (void)viewDidLoad
{
UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self actionselector(rightSwipeHandle];
[recognizer setDirectionUISwipeGestureRecognizerDirectionRight)];
[recognizer setNumberOfTouchesRequired:1];
[secondView addGestureRecognizer:recognizer];
[recognizer release];
UISwipeGestureRecognizer *recognizerleft = [[UISwipeGestureRecognizer alloc] initWithTarget:self actionselector(leftSwipeHandle];
[recognizerleft setDirectionUISwipeGestureRecognizerDirectionLeft)];
[recognizerleft setNumberOfTouchesRequired:1];
[secondView addGestureRecognizer:recognizerleft];
[recognizerleft release];
[self.view addSubview:secondView];
[super viewDidLoad];
}
//To set the frame position of the view
- (void)rightSwipeHandleUISwipeGestureRecognizer*)gestureRecognizer
{
NSLog(@"rightSwipeHandle");
[UIView beginAnimations"viewanimations" context:nil];
[UIView setAnimationDuration:0.8];
[UIView setAnimationDelegate:self];
secondView.frame=CGRectMake(360, 0, 660, 768);
[UIView commitAnimations];
}
//To set the frame position of the view
- (void)leftSwipeHandleUISwipeGestureRecognizer*)gestureRecognizer
{
NSLog(@"leftSwipeHandle");
[UIView beginAnimations"viewanimations" context:nil];
[UIView setAnimationDuration:0.8];
[UIView setAnimationDelegate:self];
secondView.frame=CGRectMake(200, 0, 858, 768);
[UIView commitAnimations];
}
关于ios - UIview 动画将一个 View 覆盖到另一个 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11561687/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |