我有一个关于定制的问题UIAlertView
如何将自定义UIbutton添加到UIAlertView?
我自定义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];
什么是您的需要确切 – 2012-03-14 06:13:23
它应该工作。您可以在这里添加您的alertview的屏幕截图以及您如何分配alertview? – Dee 2012-03-14 06:17:29
不需要我猜测,这只是违反苹果的规则,您的应用程序很可能会被拒绝 – doNotCheckMyBlog 2012-03-14 06:41:24