#import
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)