我编码了这个:
UIButton *buttonPrint = [UIButton buttonWithType:UIButtonTypeCustom];
[buttonPrint setImage:[UIImage imageNamed:@"stampa.png"] forState:UIControlStateNormal];
buttonPrint.frame = CGRectMake(15, 5, 117, 41);
[buttonPrint addTarget:self action:@selector(print) forControlEvents:UIControlEventTouchUpInside];
[viewBack addSubview:buttonPrint];
//button mail
UIButton *buttonMail = [UIButton buttonWithType:UIButtonTypeCustom];
[buttonMail setImage:[UIImage imageNamed:@"mail.png"] forState:UIControlStateNormal];
buttonMail.frame = CGRectMake(0, 46, 117, 41);
[buttonMail addTarget:self action:@selector(sendEmail) forControlEvents:UIControlEventTouchUpInside];
[viewBack addSubview:buttonMail];
//button facebook
UIButton *buttonPublish = [UIButton buttonWithType:UIButtonTypeCustom];
[buttonPublish setImage:[UIImage imageNamed:@"pubblica.png"] forState:UIControlStateNormal];
buttonPublish.frame = CGRectMake(20, 90, 117, 41);
[buttonPublish addTarget:self action:@selector(publish) forControlEvents:UIControlEventTouchUpInside];
[viewBack addSubview:buttonPublish];
//button twitter
UIButton *buttonTweet = [UIButton buttonWithType:UIButtonTypeCustom];
[buttonTweet setImage:[UIImage imageNamed:@"tweet.png"] forState:UIControlStateNormal];
buttonTweet.frame = CGRectMake(4, 130, 117, 41);
[buttonTweet addTarget:self action:@selector(tweet) forControlEvents:UIControlEventTouchUpInside];
[viewBack addSubview:buttonTweet];
- (void)sendEmail {
NSLog(@"mail clicked");
}
- (void)tweet {
NSLog(@"tweetClicked");
}
- (void)print {
NSLog(@"printClicked");
}
- (void)publish {
NSLog(@"face clicked");
}
但按钮不起作用......我该怎么办?