Is there a memory leaks when I set an attribut in this way :
titleView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 0, 300, 5)];
And is there a difference with
UIWebView *newWebView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 0, 300, 5)];
[self setTitleView:newWebView];
[newWebView release];
Thanks,
EDIT :
I’m releasing the titleView in the dalloc function
Assuming you have a property called titleView.
First one leaks, unless you release it on dealloc (but beware if you are assigning it more than once)
correct one should be:
it is always good practice to use self.propertyName as it also releases the old value.