iOS查看类的私有方法


    #import <objc/runtime.h>
    const char *cClassName = [@"UIEvent" UTF8String];
    id classM = objc_getClass(cClassName);
    unsigned int *outCount;
    
    Method *methods = class_copyMethodList(classM, &outCount);
    for (int i = 0; i < outCount; i++) {
        Method method = methods[i];
        NSString *attributeName = NSStringFromSelector(method_getName(method));
        NSLog(@"Method %d: %@", i, attributeName);
    }



输出如下:

2015-11-15 16:59:57.121 test[10798:11079924] Method 0: dealloc

2015-11-15 16:59:57.121 test[10798:11079924] Method 1: _init

2015-11-15 16:59:57.121 test[10798:11079924] Method 2: _screen

2015-11-15 16:59:57.121 test[10798:11079924] Method 3: _hidEvent

2015-11-15 16:59:57.121 test[10798:11079924] Method 4: coalescedTouchesForTouch:

2015-11-15 16:59:57.121 test[10798:11079924] Method 5: _setHIDEvent:

2015-11-15 16:59:57.121 test[10798:11079924] Method 6: touchesForGestureRecognizer:

2015-11-15 16:59:57.121 test[10798:11079924] Method 7: allTouches

2015-11-15 16:59:57.122 test[10798:11079924] Method 8: _gsEvent

2015-11-15 16:59:57.122 test[10798:11079924] Method 9: _windows

2015-11-15 16:59:57.122 test[10798:11079924] Method 10: _isKeyDown

2015-11-15 16:59:57.122 test[10798:11079924] Method 11: _modifiedInput

2015-11-15 16:59:57.122 test[10798:11079924] Method 12: _setGSEvent:

2015-11-15 16:59:57.122 test[10798:11079924] Method 13: _triggeringPhysicalButton

2015-11-15 16:59:57.122 test[10798:11079924] Method 14: _focusHeading

2015-11-15 16:59:57.122 test[10798:11079924] Method 15: _moveDirection

2015-11-15 16:59:57.122 test[10798:11079924] Method 16: _digitizerLocation

2015-11-15 16:59:57.122 test[10798:11079924] Method 17: _sendEventToResponder:

2015-11-15 16:59:57.123 test[10798:11079924] Method 18: _wheelVelocity

2015-11-15 16:59:57.123 test[10798:11079924] Method 19: _modifierFlags

2015-11-15 16:59:57.123 test[10798:11079924] Method 20: _unmodifiedInput

2015-11-15 16:59:57.123 test[10798:11079924] Method 21: touchesForWindow:

2015-11-15 16:59:57.123 test[10798:11079924] Method 22: touchesForView:

2015-11-15 16:59:57.123 test[10798:11079924] Method 23: predictedTouchesForTouch:

2015-11-15 16:59:57.123 test[10798:11079924] Method 24: _setTimestamp:

2015-11-15 16:59:57.123 test[10798:11079924] Method 25: _initWithEvent:touches:

2015-11-15 16:59:57.124 test[10798:11079924] Method 26: _touchesForGestureRecognizer:

2015-11-15 16:59:57.124 test[10798:11079924] Method 27: _shakeState

2015-11-15 16:59:57.124 test[10798:11079924] Method 28: _allPhysicalButtons

2015-11-15 16:59:57.124 test[10798:11079924] Method 29: _physicalButtonsForResponder:

2015-11-15 16:59:57.124 test[10798:11079924] Method 30: _physicalButtonsForGestureRecognizer:

2015-11-15 16:59:57.124 test[10798:11079924] Method 31: isKeyDown

2015-11-15 16:59:57.124 test[10798:11079924] Method 32: type

2015-11-15 16:59:57.124 test[10798:11079924] Method 33: subtype

2015-11-15 16:59:57.124 test[10798:11079924] Method 34: timestamp

2015-11-15 16:59:57.125 test[10798:11079924] Method 35: (null)

2015-11-15 16:59:57.125 test[10798:11079924] Method 36: (null)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值