修改 方法 review by daiqiang
Showing
2 changed files
with
7 additions
and
9 deletions
@@ -111,7 +111,7 @@ void yher_collectionViewDidSelectItemAtIndexPath(id self, SEL _cmd, id collectio | @@ -111,7 +111,7 @@ void yher_collectionViewDidSelectItemAtIndexPath(id self, SEL _cmd, id collectio | ||
111 | 111 | ||
112 | Method originMethod = class_getInstanceMethod(delegateClass, originMethodSEL); | 112 | Method originMethod = class_getInstanceMethod(delegateClass, originMethodSEL); |
113 | 113 | ||
114 | - Class class = GetSelectorInsClass(delegateClass,originMethodSEL,originMethod); | 114 | + Class class = GetCollectionViewSelectorInsClass(delegateClass,originMethodSEL,originMethod); |
115 | 115 | ||
116 | if (class_addMethod(class, swizzleMethodSEL, (IMP)yher_collectionViewDidSelectItemAtIndexPath, "v@:@@")) { | 116 | if (class_addMethod(class, swizzleMethodSEL, (IMP)yher_collectionViewDidSelectItemAtIndexPath, "v@:@@")) { |
117 | Method swizzleMethod = class_getInstanceMethod(class, swizzleMethodSEL); | 117 | Method swizzleMethod = class_getInstanceMethod(class, swizzleMethodSEL); |
@@ -123,7 +123,7 @@ void yher_collectionViewDidSelectItemAtIndexPath(id self, SEL _cmd, id collectio | @@ -123,7 +123,7 @@ void yher_collectionViewDidSelectItemAtIndexPath(id self, SEL _cmd, id collectio | ||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | -Class GetSelectorInsClass(Class hclass, SEL sel, Method sel_method) { | 126 | +Class GetCollectionViewSelectorInsClass(Class hclass, SEL sel, Method sel_method) { |
127 | Class super_class = [hclass superclass]; | 127 | Class super_class = [hclass superclass]; |
128 | if (!super_class) { | 128 | if (!super_class) { |
129 | return hclass; | 129 | return hclass; |
@@ -132,6 +132,6 @@ Class GetSelectorInsClass(Class hclass, SEL sel, Method sel_method) { | @@ -132,6 +132,6 @@ Class GetSelectorInsClass(Class hclass, SEL sel, Method sel_method) { | ||
132 | if (method != sel_method) { | 132 | if (method != sel_method) { |
133 | return hclass; | 133 | return hclass; |
134 | } | 134 | } |
135 | - return GetSelectorInsClass(super_class, sel, sel_method); | 135 | + return GetCollectionViewSelectorInsClass(super_class, sel, sel_method); |
136 | } | 136 | } |
137 | @end | 137 | @end |
@@ -109,7 +109,6 @@ void yher_tableViewDidSelectRowAtIndexPath(id self, SEL _cmd, id tableView, NSIn | @@ -109,7 +109,6 @@ void yher_tableViewDidSelectRowAtIndexPath(id self, SEL _cmd, id tableView, NSIn | ||
109 | } | 109 | } |
110 | 110 | ||
111 | } | 111 | } |
112 | - | ||
113 | - (void)yher_tableViewSetDelegate:(id<UITableViewDelegate>)delegate { | 112 | - (void)yher_tableViewSetDelegate:(id<UITableViewDelegate>)delegate { |
114 | [self yher_tableViewSetDelegate:delegate]; | 113 | [self yher_tableViewSetDelegate:delegate]; |
115 | 114 | ||
@@ -123,10 +122,10 @@ void yher_tableViewDidSelectRowAtIndexPath(id self, SEL _cmd, id tableView, NSIn | @@ -123,10 +122,10 @@ void yher_tableViewDidSelectRowAtIndexPath(id self, SEL _cmd, id tableView, NSIn | ||
123 | Class delegateClass = [delegate class]; | 122 | Class delegateClass = [delegate class]; |
124 | 123 | ||
125 | SEL swizzleMethodSEL = NSSelectorFromString(@"yher_tableViewDidSelectRowAtIndexPath"); | 124 | SEL swizzleMethodSEL = NSSelectorFromString(@"yher_tableViewDidSelectRowAtIndexPath"); |
126 | - | 125 | + |
127 | Method originMethod = class_getInstanceMethod(delegateClass, originMethodSEL); | 126 | Method originMethod = class_getInstanceMethod(delegateClass, originMethodSEL); |
128 | 127 | ||
129 | - Class class = GetSelectorInsClass(delegateClass,originMethodSEL,originMethod); | 128 | + Class class = GetTableViewSelectorInsClass(delegateClass,originMethodSEL,originMethod); |
130 | 129 | ||
131 | if (class_addMethod(class, swizzleMethodSEL, (IMP)yher_tableViewDidSelectRowAtIndexPath, "v@:@@")) { | 130 | if (class_addMethod(class, swizzleMethodSEL, (IMP)yher_tableViewDidSelectRowAtIndexPath, "v@:@@")) { |
132 | Method swizzleMethod = class_getInstanceMethod(class, swizzleMethodSEL); | 131 | Method swizzleMethod = class_getInstanceMethod(class, swizzleMethodSEL); |
@@ -138,7 +137,7 @@ void yher_tableViewDidSelectRowAtIndexPath(id self, SEL _cmd, id tableView, NSIn | @@ -138,7 +137,7 @@ void yher_tableViewDidSelectRowAtIndexPath(id self, SEL _cmd, id tableView, NSIn | ||
138 | } | 137 | } |
139 | } | 138 | } |
140 | 139 | ||
141 | -Class GetSelectorInsClass(Class hclass, SEL sel, Method sel_method) { | 140 | +Class GetTableViewSelectorInsClass(Class hclass, SEL sel, Method sel_method) { |
142 | Class super_class = [hclass superclass]; | 141 | Class super_class = [hclass superclass]; |
143 | if (!super_class) { | 142 | if (!super_class) { |
144 | return hclass; | 143 | return hclass; |
@@ -147,7 +146,6 @@ Class GetSelectorInsClass(Class hclass, SEL sel, Method sel_method) { | @@ -147,7 +146,6 @@ Class GetSelectorInsClass(Class hclass, SEL sel, Method sel_method) { | ||
147 | if (method != sel_method) { | 146 | if (method != sel_method) { |
148 | return hclass; | 147 | return hclass; |
149 | } | 148 | } |
150 | - return GetSelectorInsClass(super_class, sel, sel_method); | 149 | + return GetTableViewSelectorInsClass(super_class, sel, sel_method); |
151 | } | 150 | } |
152 | - | ||
153 | @end | 151 | @end |
-
Please register or login to post a comment