Ghass.64
Ghass.64

Reputation: 365

how to use the UIWebView inside the message in UIAlertView?

can anyone help me with this issue? i tried it but the frame of the webview is not fitting good, i want to use the alert as a terms and condition in the beginning of my app so the text would be bigger thats why i want to use webview instead of using string of the message and the text am using is not english its arabic thats why its not looking good if used the normal string

please anyone could help me .... this is how it looks:

 UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Terms and Condition", @"Terms and Condition") message:terms delegate:self cancelButtonTitle:NSLocalizedString(@"Accept", @"Accept")                                             otherButtonTitles:NSLocalizedString(@"Cancel",@"Cancel"), nil];

 [alert setFrame:CGRectMake(alert.frame.origin.x,alert.frame.origin.y, alert.frame.size.width, 150)];
 UIWebView *webView = [[UIWebView alloc] init];
 [webView setFrame:CGRectMake(12,45,260,100)];
  [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
 [alert addSubview:webView];
 [alert show];

Upvotes: 0

Views: 1259

Answers (2)

thvanarkel
thvanarkel

Reputation: 1611

You do not want to do this, as Apple might reject your app if you do. In the Human Interface Guide it states that you should

"Avoid creating an alert message that is too long. If possible, keep the message short enough to display on one or two lines. If the message is too long it will scroll, which is not a good experience."

For what you want to achieve here, I would say that you display a modal view controller with an UIScrollView or a UIWebView which contains your terms and agreements.

Upvotes: 1

Antonio MG
Antonio MG

Reputation: 20410

Unfortunately you cannot do that, the best option is to create an UIView that looks exactly like your AlertView, and then put an UIView inside.

Let us know if you need help with that, good luck!

Upvotes: 0

Related Questions