I should have known this from my experience in Flash! The solution to why it only draws the first polygon is that the same buttons, Increase and Decrease, required multiple, in this case 2, actions, not just one. Basically you need to define another method, inside the polygonview, which calls setNeedsDispaly. And hook up the same buttons in the nib file to that method.
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?
This is based on the stanford assignment 2B but its the basic layout for the design using the MVC. MVC is a template for design that you can use in iphone dev.
The model is where you define a new class of object and the methods it will perform. In this case, simply the contraints of min and max sides as well as the angles, name and description methods of a polygon.
Then the controller files define the class for all the interface controls and the methods they use.
Basically these controls will communicate with the model objects to update them of changes from the user actions in the view.
The model will then check itself and notify the controller of its methods and the controller will turn around and update the view objects in the xib.
EXAMPLE WITH AN ANIMAL CATALOG
The model will have the definition of an animal. If its a mammal or reptile, what color it is, does it have hair, how many legs or extremities.
In the view you will display an animal with data received from the controller. Also the controller will present the view to the interface for him to select different animals from the screen.
The controller will translate user selections to go fetch the animal properties according to user selection and update the view the user sees.