UIImage

2017年4月24日
1.獲取圖片自身的大小,設置frame

+ (PlaceholderView *)addPlaceholderView:(UIViewController*)vc withImage:(NSString*)imageName andHint:(NSString*)hint
{
    NSString *name = ([imageName length] > 0) ? imageName : @"TrainDefaultCover";
    UIImage *image = IMG(name);
    NSString *title = ([hint length] > 0) ? hint : @"暫時沒有內容";
    CGSize size = image.size;

    PlaceholderView *defaultVc = [[PlaceholderView alloc]initPlaceholderViewSize:[UIScreen mainScreen].bounds.size WithImageWidth:size.width height:size.height imageName:name title:title];
    [vc.view addSubview:defaultVc];
    return defaultVc;
}

如果您發現本文對你有所幫助,如果您認為其他人也可能受益,請把它分享出去。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容