2014-01-24 37 views
-1

我有GRAlertView文件。我將它們導入到我的項目中。仍然我沒有得到我的輸出視圖中的自定義視圖。這是怎麼回事?我得到一個正常的警報視圖。有誰知道如何使用GRAlertView文件來自定義alertView?

+0

我相信這會幫助你https://github.com/goncz9/GRAlertView。 –

+0

這個鏈接是我想要的那個。但是它的意思是說要在我的項目中導入這些.m和.h文件。我試過這種方式,但輸出沒有效果。 – user3202087

+0

導入這些文件後..這是我在我的項目中使用的代碼 – user3202087

回答

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不理解的意見

+0

是的......我理解了評論,我也嘗試了上面的代碼......仍然輸出是一樣的..沒有變化。你可以嘗試一下並檢查。 – user3202087

+0

我已將第二個代碼用於自定義提醒。在viewDidLoad中創建一個按鈕,並在選擇按鈕時,我把上面的代碼。不知何故,它的定製部分沒有得到使用,不知道如何。 – user3202087

相關問題