2
我使用的是AlertView有一个UITextView子视图,让用户在我的应用程序回复的帖子,但我想提醒的回复按钮禁用当用户键入超过字符的限制更多。将禁用像这样的警报视图按钮让我的应用程序被拒绝,有没有更好的方法来做到这一点?禁用UIAlertView按钮是否会拒绝我的应用程序?
-(void)textViewDidChange:(UITextView *)textView {
if (!replyAlert) {
return;
}
//character count
replyAlert.title = [NSString stringWithFormat:@"Reply to Post (%i/250)", [textView.text length]];
if ([textView.text length]>=250) {
//disable alert view button
for (UIView* view in [replyAlert subviews])
{
if ([[[view class] description] isEqualToString:@"UIAlertButton"])
{
UIButton *button = (UIButton*)view;
if ([button.titleLabel.text isEqualToString:@"Reply"]) {
//disable
button.enabled = NO;
}
}
}
} else if ([textView.text length]==249) {
//re-enable button if user deleted a character
for (UIView* view in [replyAlert subviews])
{
if ([[[view class] description] isEqualToString:@"UIAlertButton"])
{
UIButton *button = (UIButton*)view;
if ([button.titleLabel.text isEqualToString:@"Reply"]) {
//enable
button.enabled = YES;
}
}
}
}
}
添加文本视图,以提醒观点肯定是不合格的理由 - 我已经看到了它拒绝了多次。苹果增加了这一点,一会儿有,若必须发现任何情况下,在下次存储更新被替换的宽限期自己的支持。 – Adam 2012-08-13 23:54:01
欢呼亚当 - 我已根据您的反馈编辑了答案,以便其他人不会得到错误的印象。 – gamozzii 2012-08-14 06:07:14