I'm using logos for iPhone (MobileSubstrate addons), with a .h file for my
@interface MyClass : NSObject <UIAlertViewDelegate>
and the
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex == 0) {
is in the .m, but nothing is working, when tapping the buttons on the alert, it doesn't invoke what I have set for each buttonIndex.
Thanks.
Edit: Here's what I've got;
#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
Define your alert within that class and declare the alert delegate to self hope it start working to you