分配时同步 NSUserDefault 会增加内存。
你好。我使用 NSUserdefault 来存储来自其中一个控制器的图像名称(单击按钮),该控制器设置其余控制器的背景图像。我还在同步默认值,以便一切正常。 但是,当我打开分配工具时,每当我更改图像名称并通过单击同步 NSUserDefault
时,就会出现问题按钮,分配显示内存分配增加了大约1 MB。
因此,如果有人知道为什么会发生这种情况,或者有解决方案,可以告诉我吗?
Hello. I am using NSUserdefault
's for storing the image name from one of the controllers (on the click of a button) which sets the background image of the rest of the controllers. I am also synchronizing the default so that everything works fine. BUT, the problem arises when I open the allocation tool, whenever I am changing the image name and synchronising the NSUserDefault
's on the click of the button, the allocation shows an increase in memory allocation of about 1 MB.
So if anyone knows why this is happening, or has the solution then, could you please let me know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了答案,而不是用代码设置背景
[self.view setBackgroundColor[UIColor colorWithPatternImage:[UIImage imageNamed:@"imageName"]]];
我已经采取了 imageView 并使用它的属性来设置视图控制器视图的背景。它工作正常,但我仍然需要知道为什么不是我的第一个方法?
I found the answer ,instead of setting background with the code
[self.view setBackgroundColor[UIColor colorWithPatternImage:[UIImage imageNamed:@"imageName"]]];
I have taken an imageView and used it's property to set the background of viewcontroller's view.It's working fine but still I need to know why not my first apporach?