有谁知道如何使用GRAlertView文件来自定义alertView?

时间:2014-01-24 12:49:47

标签: ios ipad

我有GRAlertView文件。我将它们导入我的项目。我仍然没有在输出视图中获得自定义视图。怎么会这样?我正在获得正常的警报视图。

1 个答案:

答案 0 :(得分:0)

请检查此链接GRAlertView

导入文件后尝试此操作。

警告图标:

GRAlertView *alert = [[GRAlertView alloc] initWithTitle:@"Alert"
                                                        message:@"Be careful!"
                                                       delegate:self
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"OK", nil];
        alert.style = GRAlertStyleAlert;            // set UIAlertView style
        alert.animation = GRAlertAnimationLines;    // set animation type
        [alert setImage:@"alert.png"];              // add icon image
        [alert show];

自定义提醒图标:

GRAlertView *alert = [[GRAlertView alloc] initWithTitle:@"Custom Alert"
                                           message:@"Merry Christmas!"
                                          delegate:self
                                 cancelButtonTitle:nil
                                 otherButtonTitles:@"Close", nil];

        [alert setTopColor:[UIColor colorWithRed:0.7 green:0 blue:0 alpha:1]
               middleColor:[UIColor colorWithRed:0.5 green:0 blue:0 alpha:1]
               bottomColor:[UIColor colorWithRed:0.4 green:0 blue:0 alpha:1]
                 lineColor:[UIColor colorWithRed:0.7 green:0 blue:0 alpha:1]];

        [alert setFontName:@"Cochin-BoldItalic"
                 fontColor:[UIColor greenColor]
           fontShadowColor:[UIColor colorWithRed:0.8 green:0 blue:0 alpha:1]];

        [alert setImage:@"santa.png"];
        [alert show];


注意:GRAlertView复制示例,因为OP不理解评论