我使用标识为iPhone(MobileSubstrate有插件),与.h文件我UIAlertView中没有响应UIAlertViewDelegate
@interface MyClass : NSObject <UIAlertViewDelegate>
和
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if(buttonIndex == 0) {
是在.m,但没有任何工作,当点击警报上的按钮时,它不会调用我为每个buttonIndex设置的内容。
谢谢。
编辑:这是我得到的;
#import "Tweak.h"
%hook ASApplicationPageHeaderView
- (void)_showPurchaseConfirmation {
UIAlertView *alert = [[UIAlertView alloc] init];
[alert setTitle:@"title"];
[alert setMessage:@"message"];
[alert setDelegate:self];
[alert addButtonWithTitle:@"button 1"];
[alert addButtonWithTitle:@"continue"];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) { //also tried (UIAlertView *)alertView
UIAlertView *lol = [[UIAlertView alloc] init];
[lol setTitle:@"button 1"];
[lol setMessage:@"button 1"];
[lol setDelegate:self];
[lol addButtonWithTitle:@"lol"];
[lol show];
[lol release];
} else {
%orig;
}
}
%end
更多信息&无耻的插件:http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c/626946 – 2011-02-05 15:04:38
我试着设置警报的委托自我和零,没有任何作品。 – Mitochondria 2011-02-05 15:17:00