【发布时间】:2013-03-08 21:22:24
【问题描述】:
注意:此代码不是原始代码的精确复制品,而是说明(非常准确)问题所在,以及我对代码的意图是什么。
我在DaClass1 的视图中添加了一个按钮(这很好):
%hook DaClass1
-(id)DaView {
UIButton *xButton = [UIButton buttonWithType:UIButtonTypeCustom];
[xButton addTarget:self action:@selector(dismissWithAnimation:YES:nil)
forControlEvents:UIControlEventTouchUpInside];
[xButton setBackgroundImage:[UIImage imageWithContentsOfFile:@"/Hello.png"] forState:UIControlStateNormal];
xButton.frame = CGRectMake(0, 0, 30, 30);
[self addSubview:xButton];
return %orig;
}
%end
但UIButton 的action: (dismissWithAnimation:YES:nil) 实际上来自另一个类:
%hook DaClass2
-(void)dismissWithAnimation:(int) reason:(int) {
//someCodeHere...
}
%end
当 UIButton 在DaClass1 中时,我如何从我的UIButton 的action: 中调用DaClass2 中的dismissWithAnimation?
【问题讨论】:
标签: function ios6 jailbreak theos logos