UIActionSheetを作成するこのコードの何が問題になっていますか? delegate:selfについて不平を言っていますが、その理由はわかりません。 これが私のコードです:
-(IBAction)SocialButtonPressed:(id)sender{
UIActionSheet *social = [[UIActionSheet alloc]initWithTitle:@"Share"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Twitter"
otherButtonTitles:@"Facebook", @"iMessage", @"Mail", nil];
[social showInView:self.view];
}
回答:
回答№1は2クラスをそのプロトコルに準拠させる:
@interface MyClass : NSObject <UIActionSheetDelegate>