カスタマイズに関するご質問がありますUIAlertView
UIAlertViewにカスタムUIbuttonを追加するには?
UIAlertView
は、背景とボタンでもカスタマイズできます。カスタムボタンを追加しますが、ボタンのアクションをトリガーすることはできません。カスタムボタンはUIAlertView
に追加されますが、どのようにアクションを追加できないのですか?私を助けてください。それはUIAlertView
が私たちにカスタムボタンを持たせることができないからですか?
UIButton *firstButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 120, 90, 30)];
UIButton *secondButton = [[UIButton alloc] initWithFrame:CGRectMake(180, 120, 90, 30)];
UIImage *btnImage = [UIImage imageNamed:kButtonBlackImage];
[firstButton setBackgroundImage:btnImage forState:UIControlStateNormal];
[firstButton setTitle:@"Don't Favorite" forState:UIControlStateNormal];
firstButton.titleLabel.font = BOLDFONTSMALL;
[firstButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[firstButton addTarget:self action:@selector(cancelFavorite:) forControlEvents:UIControlEventTouchUpInside];
[secondButton setBackgroundImage:btnImage forState:UIControlStateNormal];
[secondButton setTitle:@"Save Favorite" forState:UIControlStateNormal];
[secondButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
secondButton.titleLabel.font = BOLDFONTSMALL;
[secondButton addTarget:nil action:@selector(addFavorite:) forControlEvents:UIControlEventTouchUpInside];
[alert addSubview:firstButton];
[alert addSubview:secondButton];
あなたの必要性は正確に –
うまくいくはずです。ここであなたのalertviewのスクリーンショットを追加できますか?そしてalertviewをどのように割り当てましたか? – Dee
私が推測する必要はありません、それはAppleのルールに違反し、あなたのアプリケーションは拒否される可能性が高いです – doNotCheckMyBlog