iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
binarymann
V2EX  ›  iDev

问个 UITapGestureRecognizer 的小白问题,关于每次 tap 后 index 递增

  •  
  •   binarymann · May 20, 2014 · 2784 views
    This topic created in 4526 days ago, the information mentioned may be changed or developed.
    在viewDidLoad中:
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hanldeTap:)];
    [self.view addGestureRecognizer:tap];

    处理点击事件的方法
    - (void)hanldeTap:(UITapGestureRecognizer *)gr
    {
    NSUInteger index = 1;
    index++;
    NSLog(@"%d", index);
    }

    为何我点击后index都不递增呢?NSLog出来的值都是2,肯定是我没有将方法调用对
    2 replies  •  2014-05-20 14:25:01 +08:00
    guitarkitten
        1
    guitarkitten  
       May 20, 2014   ❤️ 1
    static NSUInteger index = 1;
    binarymann
        2
    binarymann  
    OP
       May 20, 2014
    @guitarkitten 原来如此,感谢guitarkitten!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2899 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 05:51 · PVG 13:51 · LAX 22:51 · JFK 01:51
    ♥ Do have faith in what you're doing.