-2

iOS 6 でジェイルブレイクされた iPhone を使用しています

UIAlertView を押した後にのみ BOOL 値を返そうとしています

%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
4

2 に答える 2