Как добавить TextView 320 * 460 в iPhone UIAlertView - PullRequest
1 голос
/ 30 января 2012

Я показываю EULA в начале, когда у UIAlertView есть кнопка Accept.Я успешно следовал за ответом на Проблема с открытием страницы (страница лицензионного соглашения) ссылка.

Я просто хочу показать 6 страниц лицензионного соглашения в начале, но не могу показать полноеразмер textview / scrollview с содержанием EULA в Alertview.Может ли кто-нибудь предложить мне правильный путь.Заранее спасибо.

1 Ответ

2 голосов
/ 30 января 2012

Вы можете сделать alertView любого размера и добавить собственный TextView любого размера.Используйте фрагмент кода

- (void) doAlertViewWithTextView {

UIAlertView *alert = [[UIAlertView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];

alert.title = nil;
alert.message = nil;
alert.delegate = self;
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:nil];

UITextView *textView = [[UITextView alloc] initWithFrame:alert.bounds];
textView.text = @"This is what i am trying to add in alertView.\nHappy New Year Farmers! The new Winter Fantasy Limited Edition Items have arrived! Enchant your orchard with a Icy Peach Tree, and be the first farmer among your friends to have the Frosty Fairy Horse. Don't forget that the Mystery Game has been refreshed with a new Winter Fantasy Animal theme! ";
textView.keyboardAppearance = UIKeyboardAppearanceAlert;
textView.editable = NO;
[alert addSubview:textView];
[textView release];

[alert show];
[alert release];

}

Но если сделать размер alertView равным размеру всего экрана iPhone, вы потеряете кнопку отмены.

Также используйте этот метод делегата.

- (void)willPresentAlertView:(UIAlertView *)alertView {

[alertView setFrame:CGRectMake(0, 0, 320, 460)];}
...