图像保存后 iOS CPU% 保持高位
我有一个应用程序,显示我保存到应用程序的图像的缩略图,然后用户点击缩略图,他们会看到可以浏览的全尺寸图像(类似于照片应用程序)
我注意到的问题是,当我从 UIImagePicker 添加图像,然后再次点击缩略图,CPU 会跳至 140-150%(或更高)并保持在那里。
仅当我通过选择器将新图像保存到文档目录时,我才能每次复制此内容。
我正在使用活动监视器来查看 CPU%。我很好奇是否其他人也遇到过类似的情况,或者对导致这种情况的原因有任何想法。这可能只是我对活动监视器仪器的误解。
感谢您抽出时间。
I have an app that shows thumbnails of images that I save to app, then the user taps on a thumbnail they see a full size image that they can flick through (similar to the photos app)
My issue, that I noticed is that when I add images from a UIImagePicker, then tap on a thumbnail again, the CPU jumps up to 140-150% (or higher) and stays there.
I am able to replicate this every time only when I save a new image to the documents directory via the picker.
I was using the Activity Monitor to view the CPU%. I am curious if anyone else ever had a similar situation, or have any ideas as to what can cause this. This can possibly just my misinterpretation of the Activity Monitor Instrument.
Thank you for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是我用来保存图像的 NSInitationOperation。当我删除它时,我在所有设备上的性能都大大提高了。
我不知道为什么会出现这种情况,但删除它有帮助。谢谢大家的评论。它已经追查这个问题一段时间了,直到我确信这是一个内存问题。我必须阅读有关 NSInitationOperation 的更多内容才能了解我的根本问题是什么。
Turns out, it was the NSInvocationOperation I was using to save my images. The moment I removed that, my performance on all devices drastically improved.
I do not know why this is the case however, but removing it helped. Thank you all for your comments. It was chasing down this issue for a while, to the point where I was certain it was a memory issue. I must read more on the NSInvocationOperation to understand what my underlying issue was.