iphone - Using self dot notation doesn't call dealloc -


My visual controller class's dellok method is not popped after being pushed with the following code: self.playerViewController = [[Videoplayer view controller alloc] init]; [Self. Player Week Controller Set_Video: Video]; [Self. Navigation controller Push ViewController: self Player. Animated controller: yes]; [Self. Playwear Controller Release];

However, if I change the push code to the following, then my viewlock is populated by the view controller after popping:

  playerViewController = [[ VideoPlayerViewController Alloc] init]; [Player view controller set_video: video]; [Self. Navigation controller Push ViewController: Animated Player Viewer: Yes]; [Player view controller release];   

I thought I understood the use of dot notation / self, but not clearly. Can anyone explain the problem here?

Here is the property:

  @property (nonatomic, retain) VideoPlayerViewController * playerViewController;   

And synthesis is here:

  @synthesize playerViewController;    

You retain it twice.

  PlayerViewController itself = [[Videoplayer view controller alloc] init]; ^ Keep ^ 1 ^^^^^ retain + 1   

But you only leave one time.

To correct your memory management problem, you can change the code in something like this:

  self.playerViewController = [[[VideoPlayerViewController alloc] init] autorelease ];   

And many people say [self.foo release] is bad style you can call it [foo release] < / P>

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -