0

嗨,我想实现一个带有 Web 链接的警报视图。

是否可以?它不应该像警报视图中的按钮一样显示。

4

3 回答 3

2

将文本视图添加到 UIAlertView 并使用此启用属性

textview.dataDetectorTypes=UIDataDetectorTypeLink;

它会工作的!

于 2012-06-04T08:04:43.380 回答
1

UIAlertView

UIAlertView *_alert = [[UIAlertView alloc] initWithTitle:@"Search Google?" 
                                                 message:@"Launch Google and search for something?" 
                                                delegate:self 
                                       cancelButtonTitle:@"Nah" 
                                       otherButtonTitles:@"Google It!",nil];
[_alert show];

UIAlertView 委托

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{
    if( buttonIndex == 1 ) /* NO = 0, YES = 1 */
    {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://google.com"]];
    }
}
于 2012-06-04T07:39:38.827 回答
-1

请雇用initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:。您可以将链接标题添加为 anotherButtonTitles和employee

 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{}

单击链接按钮时触发某些操作,例如转到网页。

于 2012-06-04T07:40:35.367 回答