I am using jailbroken iPhone on iOS 6
I am trying to return BOOL value only after pressing an UIAlertView
%hook foo
-(void)foo
{
NSLog (@"foo");
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"alertview"
message:@"alert"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[alertView show];
[alertView release];
if ( button OK ) // only if button OK
%orig;
}
%new(v@:@@)
+(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if ((buttonIndex == 1) {
return true;
}
}
%end