开发者

question regarding memory leak detection on instruments

I am using the instrument provided with XCode 4.3 to detect memory leaks. I am getting a memory leak in the following code line. Not sure why !

 self.view.backgroundColor=[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background-non-retina.png"]];

Can anyone kindly tell me what开发者_如何学运维 I am doing wrong here ?

Thanks


backgroundColor=[[UIColoralloc] init...

Look carefully where it says alloc. Anything you alloc, init, or new you are required to release. Try using an autoreleased color, such as this:

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background-non-retina.png"]];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜