Doubts from CS193P Lectures 1-4

a) Presence1 with TableViewController.  Why the initWithNibName method in the DetailController.m contains no specific values except for the title setter? Couldnt i just set this title in the viewDidLoad?

b) Why if we call
NSMutableString *string = [[NSMutableString alloc] init]; we must later release it.  But if we called NSMutableString *string = NSMutableString string]; then we dont have to cause itll be autoreleased in the pool.  If this is so, why would we even bother calling it the first way?c) MoveMeApp from Apple Dev Center.  The placard.png image is ‘imported’ by the UIImage line in the init.  And the a CGRect frame is created based on the size of that image.  Is this app importing that image into the CGRect frame created or is it importing the image and ‘tracing a frame with the exact features of the imported png image? In other words, is it actually re-drawing the png or is it just placing it inside a frame container?

d) On Warmup 2, i get the Dictionary was mutated while being enumerated.  Ok, but isnt it a MUTABLE type dictionary? I guess that means you can change its contents later, just not during a thread operation.  Maybe something to do with the fact that the dictionary would have had to be copied?

e) in the debugger window, i dont know what the register window tells you? in debugging splitter2 i get 0×20(%edx),%edi with a red arrow left of it and so i step into it and i get a EX_BAD_ACCESS.  I found the error in code; NSString *string didnt have an assignment so the function isnt passed a value.  my question is, how does debugger point me to that mistake IN the code? cause luckily this code was short, what if it were HUGE?!  im missing something obviously.

f) i cant find anything wrong with warmup 3

g) in splitter3 i found the assign vs retain property.  I know that retain bumps up the reference count on words object vs assign which changes its value.  but the wrong example is #3 where assign is used.  and since this is NSArray object, it cant be assigned a value?  so i tried converting it to a NSMutableArray and it didnt work.  Because i think i needed then to define a setter method for it but didnt know how?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s