无法执行委托

时间:2014-06-02 15:58:06

标签: ios objective-c theos

我正在为Instagram编写一个小调整来实现一个UIalert,当双击图片询问我是否想要照片时,这是我的代码到目前为止

#import<UIKit/UIKit.h>

%hook IGFeedItemPhotoView

-(void)onDoubleTap:(id)arg1{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Attention"
                                                    message:@"Are you sure you want to like this pic?"
                                                    delegate:self



                                                cancelButtonTitle:@"Yes"
                                                otherButtonTitles:nil];
[alert addButtonWithTitle:@"No"];

[alert show];
[alert release];

}

%new(v@:@@)
 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    NSLog(@"Button Index =%ld",(long)buttonIndex);
    if (buttonIndex == 0)
    {
        nil;
    }
    else if(buttonIndex == 1)
    {
        nil;
    }
}

而不是在buttonIndex == 1中的nil我想返回方法的orig值,但我不能因为它的新方法(%new)如何让它返回%orig值?提前谢谢

0 个答案:

没有答案