开发者

Synchronization of NSUserDefault's on allocation increases memory.

开发者 https://www.devze.com 2023-04-01 19:27 出处:网络
Hello. I am using NSUserdefault\'s for storing the image name from one of the controllers (开发者_如何学JAVAon the click of a button) which sets the background image of the rest of the controllers. I

Hello. I am using NSUserdefault's for storing the image name from one of the controllers (开发者_如何学JAVAon 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?


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号