UIImage的渲染效果屬性

1 UIImageRenderingMode屬性:圖片的渲染效果。其是個結構體:包括web

UIImageRenderingModeAutomatic,          // Use the default rendering mode for the context where the image is used  使用默認的渲染效果,從屬於控件上一級的系統渲染效果spa

UIImageRenderingModeAlwaysOriginal,       // Always draw the original image, without treating it as a template   使用圖片自己的效果,不使用圖片通過模版效果處理圖片orm

 UIImageRenderingModeAlwaysTemplate,     // Always draw the image as a template image, ignoring its color information   使用模版,即便用通過模版渲染處理的圖片,無論原圖片的狀況繼承

此屬性經常使用在方法:圖片

- (UIImage *)imageWithRenderingMode:(UIImageRenderingMode)renderingMode NS_AVAILABLE_IOS(7_0);it

此屬性經常使用的場景:navigation bars, tab bars, toolbars, and segmented controls automatically treat their foreground images as templates, while image views and web views treat their images as originalsio

####尤爲注意的是:子控件和父控件的繼承關係:系統中一些屬性默認是子控件繼承父控件的屬性設置。所以在諸如透明度alpha等問題上,子控件是默認遵循父控件的設置的,父控件是不透明的,其子控件必是不透明的。form

相關文章
相關標籤/搜索