zoukankan      html  css  js  c++  java
  • Error to compile Three20 in iOS6, it not be compiled only Three20UI project. 不及格的程序员

    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 @end
    104 
    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 @end
    136 
    137 #endif
  • 相关阅读:
    如何恢复包含损坏记录的物理文件
    启动日志
    如何在各种环境中处理多成员的物理文件
    如何找出物理文件中损坏的记录
    如何重新找回物理文件中已经被删除的记录
    folder的操作
    如何将AS/400英文界面改为中文界面?
    如何从OS/400里直接发送电子邮件到Internet
    如何在AS/400上发送带有颜色的MESSAGE
    关于命令RGZPFM
  • 原文地址:https://www.cnblogs.com/ioriwellings/p/2780923.html
Copyright © 2011-2022 走看看