Categories
Iphone Developer

Presence3:NSThread & NSOperation

Im looking through Presence3, understand the LetsMakeAThread project, its pretty straight forward, detachNewThread creates a separate thread and performSelectorOnMainThread returns you to the MT, but in ThreadedFlickrTableView, whats the deal?

beginLoadingFlickrData calls a new invocation operation, which loads synchronousLoadFlickrData: which gets the data from Flickr and returns to MT via didFinishLoadingFlickrDataWithResults: which in turn creates the arrays from the FlickrData.

Then cachedImageForURL gets called from the cellForRowAtIndexPath?  And so that same method calls the ImageLoadingOperation which then returns to the main thread via didFinishLoadingImageWithResult:?

Is this chronology correct?  The MT gets separated or stopped 2x in this app? Once in beginLoadingFlickrData and then in cachedImageForURL?  The difference being that in the former, it gets called out as simply a new method within the same file whereas in the latter it gets called as a completely new class file? I guess they did it to exemplify both cases?

Categories
Iphone Developer

Memory Management Stanford CS193P iPhone Dev

Im not so clear on memory management; i understand what you create you must release, ok, but when?!  Because i just saw the MyTabBar example which creates ViewControllers, 3 of them i think, programatically, and a few lines down in the same m file, the delegate, the controllers get released.  Release means they get destroyed right?  I guess im not understanding conceptually what actually happens because to me, if you create in line 10 and release in line 20, even saying it sounds stupid to me, but its what i see, the user wont have time to use it :).

Or is it because they get created, then added to a new object, the tabbarcontroller, and therefore the individual instances created can be released because they are now part of the tabbarcontroller object which will be released some other time?