作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我能够检测到旋转手势,但我只需要检测从右到左的那个。
如果有任何帮助,我将不胜感激。
谢谢!
最佳答案
我假设您正在使用 UIRotationGestureRecognizer 来检测旋转。你应该有这样的东西:
UIRotationGestureRecognizer *gestureRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(gestureRecognizerAction:)];
[self.view addGestureRecognizer:gestureRecognizer];
和:
- (void)gestureRecognizerAction:(UIRotationGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.rotation > 0) {
//rotation in one side - lets say from left to right
} else {
//rotation in other side - lets say from right to left
}
}
通过这种方式,您将只能检测到从右到左的旋转。
关于ios - 只检测从右到左的旋转手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17733389/
目前我正在使用 [self presentModalViewController :newVC animated:YES] 。我想从左/右/顶部/底部呈现带有推送效果的 newViewcontroll
我正在尝试实现“带有上一个和下一个的部分幻灯片”。这些部分的标记如下: Section 1 Section 2 Section 3 Prev Next 除具有 acti
我的问题与此处提出的问题几乎相同:question 不同的是,我想从右边切换第 2 位和第 4 位数字,而不是像另一个问题中那样从左边切换。所以在我的例子中最右边的数字是 1。示例:283926.67
我是一名优秀的程序员,十分优秀!