uiimage 完整 iphone
iPhone 中的图像是否有“加载完成”之类的东西?
我希望能够销毁 UIActivity 指示器一次并加载图像。
执行此操作的一般最佳实践是什么?
Is there such a thing as an "on load complete" for images in iphone?
I want to be able to destroy a UIActivity indicator once and image is loaded.
What the general best practice for doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只是想在
UIImage
加载并在UIImageView
中正确显示后关闭UIActivityIndicatorView
,您可以尝试以下操作:我有承认,我没有测试上面的代码。如果有效请留下评论。
If you simply want to dismiss a
UIActivityIndicatorView
after aUIImage
has been loaded and displayed properly in aUIImageView
, you can try the following:I have to admit, I did not test the above code. Please leave a comment if it works.
UIImage
有一个同步 API。这意味着当您创建(或绘制)UIImage
时,它已被加载并解压缩。这也意味着创建(或绘制)UIImage
的方法调用可能会在加载该图像时阻塞。如果您想在加载图像时执行其他操作,则必须在后台线程上加载图像,这可以使用 Core Graphics C API 来实现。
UIImage
不是线程安全的,只能在主线程上使用。UIImage
has a synchronous API. This means that when you create (or draw) aUIImage
, it has been loaded and decompressed. This also means that a method call to creating (or drawing) aUIImage
can block for as long as it takes to load that image.If you want to do other things while loading an image, you have to load the image on a background thread, which is possible using the Core Graphics C API.
UIImage
is not thread safe and can be used on the main thread only.