Synchronization of NSUserDefault's on allocation increases memory.
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?
精彩评论