Prathiba
Prathiba

Reputation: 297

URL in Alert body

Can we put a tappable link in the alert body? Tapping the link should open the Mail client. My pressing question is that has anyone tried it and is it accepted by apple.

The alert says 'Please contact Helpdesk for more information' with an OK button - tap on 'helpdesk' and it should open the mail client.

Upvotes: 1

Views: 2718

Answers (2)

Popeye
Popeye

Reputation: 12113

From the Apple Documentation in regards to UIAlertView Class Reference

Subclassing Notes

The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

So to get the sort of customization you are talking about you would have to subclass UIAlertView which is not allowed, your app will be rejected.

However there are some alternatives to UIAlertView implementations that can be found cocoa controls.

You could just have a button that does the same as the link and than you could just use this method

- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;

To determine which button was pressed then run your mail client.

Upvotes: 4

Buntylm
Buntylm

Reputation: 7373

I think While these kind of adding customizations to a UIAlertView is strongly discouraged by Apple You can Use the UIAlertView delegate Function to detect which button is pressed and can reaction on as required.

UIAlertView *alert = [[UIAlertView alloc] init withWithTitle:@"Title" message:@"message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Your Event you want fire", nil];

- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
   switch(index)
        case 1:
              //fire Your Event you want fire
              break;
}

And if you looking some kind of change with UIAlertView One option will you cn create you own Custom AlertView try this link SO Questions

Upvotes: 2

Related Questions