博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Error to compile Three20 in iOS6, it not be compiled only Three20UI project.
阅读量:6519 次
发布时间:2019-06-24

本文共 3174 字,大约阅读时间需要 10 分钟。

Today, i had trying update my project with three20 to ios6, but somethings had raised that it reports errors (e.g. _tapCount,_view can not by finded) in file UIViewAdditions.m.

 打开文件后发现里面有宏定义,判断如果是调试阶段,会使用 私有变量 输出某些信息,结果屏避之再编译就可以了。

1 / Remove GSEvent and UITouchAdditions from Release builds  2 #ifdef DEBUG  3   4 ///  5 ///  6 ///  7 /**  8  * A private API class used for synthesizing touch events. This class is compiled out of release  9  * builds. 10  * 11  * This code for synthesizing touch events is derived from: 12  * http://cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html 13  */ 14 @interface GSEventFake : NSObject { 15   @public 16   int ignored1[5]; 17   float x; 18   float y; 19   int ignored2[24]; 20 } 21 @end 22  23  24 /// 25 /// 26 /// 27 @implementation GSEventFake 28 @end 29  30  31 /// 32 /// 33 /// 34 @interface UIEventFake : NSObject { 35   @public 36   CFTypeRef               _event; 37   NSTimeInterval          _timestamp; 38   NSMutableSet*           _touches; 39   CFMutableDictionaryRef  _keyedTouches; 40 } 41  42 @end 43  44  45 /// 46 /// 47 /// 48 @implementation UIEventFake 49  50 @end 51  52  53 /// 54 /// 55 /// 56 @interface UITouch (TTCategory) 57  58 /** 59  * 60  */ 61 - (id)initInView:(UIView *)view location:(CGPoint)location; 62  63 /** 64  * 65  */ 66 - (void)changeToPhase:(UITouchPhase)phase; 67  68 @end 69  70  71 /// 72 /// 73 /// 74 @implementation UITouch (TTCategory) 75  76  77 /// 78 - (id)initInView:(UIView *)view location:(CGPoint)location { 79   if (self = [super init]) { 80     _tapCount = 1; 81     _locationInWindow = location; 82     _previousLocationInWindow = location; 83  84     UIView *target = [view.window hitTest:_locationInWindow withEvent:nil]; 85     _view = [target retain]; 86     _window = [view.window retain]; 87     _phase = UITouchPhaseBegan; 88     _touchFlags._firstTouchForView = 1; 89     _touchFlags._isTap = 1; 90     _timestamp = [NSDate timeIntervalSinceReferenceDate]; 91   } 92   return self; 93 } 94  95  96 /// 97 - (void)changeToPhase:(UITouchPhase)phase { 98   _phase = phase; 99   _timestamp = [NSDate timeIntervalSinceReferenceDate];100 }101 102 103 @end104 105 106 ///107 ///108 ///109 @implementation UIEvent (TTCategory)110 111 112 ///113 - (id)initWithTouch:(UITouch *)touch {114   if (self == [super init]) {115     UIEventFake *selfFake = (UIEventFake*)self;116     selfFake->_touches = [[NSMutableSet setWithObject:touch] retain];117     selfFake->_timestamp = [NSDate timeIntervalSinceReferenceDate];118 119     CGPoint location = [touch locationInView:touch.window];120     GSEventFake* fakeGSEvent = [[GSEventFake alloc] init];121     fakeGSEvent->x = location.x;122     fakeGSEvent->y = location.y;123     selfFake->_event = fakeGSEvent;124 125     CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,126       &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);127     CFDictionaryAddValue(dict, touch.view, selfFake->_touches);128     CFDictionaryAddValue(dict, touch.window, selfFake->_touches);129     selfFake->_keyedTouches = dict;130   }131   return self;132 }133 134 135 @end136 137 #endif

 

 

转载地址:http://zirfo.baihongyu.com/

你可能感兴趣的文章
Spring JDBC模板惯用方式
查看>>
将公用文件夹从Exchange2010迁移到 Exchange 2013
查看>>
微信小程序开发需要了解的三个内核技术
查看>>
UML用例图概要
查看>>
动态规划算法
查看>>
WebService学习总结(二)——WebService相关概念介绍
查看>>
泥鳅般的const(一个小Demo彻底搞清楚)
查看>>
Pyqt 打开外部链接的几种方法
查看>>
JavaScript DOM编程艺术学习笔记(一)
查看>>
event.srcElement获得引发事件的控件(表单)
查看>>
ASP.NET MVC铵钮Click后下载文件
查看>>
SQL Server 中 EXEC 与 SP_EXECUTESQL 的区别
查看>>
【Bootstrap】 bootstrap-table表格组件
查看>>
基本数据结构 - 栈和队列
查看>>
NET快速信息化系统开发框架 V3.2 ->WinForm部分全部重构为Dev风格界面
查看>>
Linux软中断、tasklet和工作队列
查看>>
如何解决ORA-28002 the password will expire within 7 days问题(密码快过期)
查看>>
Asp.Net Core 轻松学-利用日志监视进行服务遥测
查看>>
Windows Mobile 系列文章索引---不断整理中(2009-07-08)
查看>>
架构语言ArchiMate - 架构视角(Viewpoint)分类框架
查看>>