在OSX 10.9之前的canDrawSubviewsIntoLayer的替代方法 [英] Alternative method for canDrawSubviewsIntoLayer prior to OSX 10.9

查看:471
本文介绍了在OSX 10.9之前的canDrawSubviewsIntoLayer的替代方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的图片视图中实现下面的代码,使gif正常动画:

I needed to implement the following code in my image view to make a gif properly animate:

self.homeView.radarImageView.animates = YES;
self.homeView.radarImageView.canDrawSubviewsIntoLayer = YES;
self.homeView.radarImageView.image = currentData.radarImage;


$ b <与OSX之前10.9。有没有另一种方法,我可以使用它将使这项工作在OSX 10.7和更高?

Unfortunately, the canDrawSubviewsIntoLayer method is not compatible with OSX prior to 10.9. Is there an alternative approach that I can use that will make this work in OSX 10.7 and higher?

推荐答案

避免基于图层的视图在10.8及以下,因为它们似乎与动画的gif混合不好

avoid layer-based views under 10.8 and below as they don't seem to mix well with animated gifs

请参阅:
如何在分层视图上显示目标C中的动画GIF?

效果而不使用图层)
对于渐变,例如有NSGradient,需要NSColors并且可以填充一个

as asked in the comment, one can draw gradients (and all other effects without using layers)
For Gradients for example there is NSGradient that takes NSColors and can fill a rect

一个NSView可以绘制所有你想要的背景:颜色,渐变,模式图像,只是一个图像,边框,圆角...所有在一个视图
https://github.com/Daij-Djan/DDBackgroundView

A NSView that can draw all that you ever want in your background: color, gradient, patttern image, just an image, a border, rounded corners... all in one view https://github.com/Daij-Djan/DDBackgroundView

这篇关于在OSX 10.9之前的canDrawSubviewsIntoLayer的替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆