iOS开发中touchesBegan和touchesEn…「建议收藏」
touchesBegan 跟 touchedEnd 沒有提供給 UIScrollViewDelegate
所以要自己建立一個繼承自 UIScrollView 的 class
重寫這兩個 method
myScrollView.h
@interface myScrollView : UIScrollView
@end
myScrollView.m
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[super touchesBegan:touches withEvent:event];
if ( !self.dragging )
{
[[self nextResponder] touchesBegan:touches withEvent:event];
}
}
-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[super touchesEnded:touches withEvent:event];
if ( !self.dragging )
{
[[self nextResponder] touchesEnded:touches withEvent:event];
}
}
之後建立 UIScrollView 就是用 myScrollView 建立 即可使用這兩個 method
myScrollView *contentScrollView = [[myScrollView alloc] init];
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/164168.html原文链接:https://javaforall.cn
相关文章
- iOS 中使用 OpenGL 实现增高功能
- IOS开发之——Position和AnchorPoint(92)「建议收藏」
- uniapp开发,window下创建ios打包证书的详情流程
- 【iOS 开发】iOS 开发 简介 (IOS项目文件 | MVC 模式 | 事件响应机制 | Storyboard 控制界面 | 代码控制界面 | Retina 屏幕图片适配)
- iOS常见文件及程序的启动原理详解手机开发
- ios UI数据库 sqlite小型数据库的增、删、改、查、排序详解手机开发
- iOS开发之17个常用代码整理详解手机开发
- iOS开发中邮箱,电话号码,身份证,密码,昵称正则表达式验证详解手机开发
- iOS获取App各种文件的路径方法汇集详解手机开发
- iOS图片处理,截图,缩放,存储详解手机开发
- iOS判断字符串是否为合法邮箱地址详解手机开发
- IOS常用加密算法详解手机开发
- ios实战-弹幕的实现详解手机开发
- iOS获取视图控制器实例的方法详解手机开发
- iOS入门之打包静态库详解手机开发
- ios基础:iOS改变状态栏字体颜色详解手机开发
- Linux下开发iOS应用:挑战还是机会?(linux做ios开发)
- 苹果升级查找功能即便iOS设备已经关机或恢复出厂设置也可以继续被定位
- Google为了拉拢iPhone用户:“转移到Android”支持从iOS转移数据
- iOS 不是 Linux,而是苹果独特操作系统(ios是linux吗)
- IOS上可以安装Oracle吗(ios能装oracle吗)
- IOS系统有支持Oracle吗(ios支持oracle吗)
- 谷歌安全团队发现OS X和iOS系统内核漏洞,苹果修复逾期
- C++开发在IOS环境下运行的LRUCache缓存功能
- JS辨别访问浏览器判断是android还是ios系统