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