会发生什么;当我向左滑动时,textView 会更改帧大小,这是我想要它做的,但是当我向右滑动时,textView 并没有变回我想要的方式,实际上它根本没有改变!
有什么帮助吗?
// Add swipeGestures
UISwipeGestureRecognizer *SwipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeReconised:)];
[SwipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
[self.view addGestureRecognizer:SwipeLeft];
UISwipeGestureRecognizer *SwipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeReconised:)];
[SwipeRight setDirection:UISwipeGestureRecognizerDirectionRight];
[self.view addGestureRecognizer:SwipeRight];
}
- (void)swipeReconised:(UISwipeGestureRecognizer *)Swipe {
if (Swipe.direction == UISwipeGestureRecognizerDirectionLeft) {
CGRect frame = [TextView frame];
frame.size.width = 750;//Some value
frame.size.height = 655;//some value
frame.origin.x = 275;
frame.origin.y = 44;
[TextView setFrame:frame];
if (Swipe.direction == UISwipeGestureRecognizerDirectionRight) {
CGRect frame = [TextView frame];
frame.size.width = 240;//Some value
frame.size.height = 655;//some value
frame.origin.x = 784;
frame.origin.y = 44;
[TextView setFrame:frame];
}
}
}