天天看點

iOS中 動态啟動圖GIF的簡單設定

版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。

原文位址:http://blog.csdn.net/qq_31810357/article/details/50498380

 // 設定位置和大小  

    cgrect frame = cgrectmake(50,340,[uiscreen mainscreen].bounds.size.width / 2,[uiscreen mainscreen].bounds.size.height / 2);  

    frame.size = [uiimage imagenamed:@"640gif.gif"].size;  

//    frame.size.width = [uiimage imagenamed:@"啟動頁640.gif"].size.width / 2;  

//    frame.size.height = [uiimage imagenamed:@"啟動頁640.gif"].size.height / 2;  

    // 讀取gif圖檔資料  

    nsdata *gif = [nsdata datawithcontentsoffile: [[nsbundle mainbundle] pathforresource:@"640gif" oftype:@"gif"]];  

    // view生成  

    uiwebview *webview = [[uiwebview alloc] initwithframe:frame];  

    webview.userinteractionenabled = no;//使用者不可互動  

    [webview loaddata:gif mimetype:@"image/gif" textencodingname:nil baseurl:nil];  

    [self.view addsubview:webview];  

繼續閱讀