April 16
note
note
Selectors are ObjC internal representation of a method name
Selector is apparently a component of the target-action design pattern. This DP was mentioned in the first Stanford lecture in the MVC discussion.
q
"Object library" b/c you generate objects with it ?
q
q
Can custom classes be added to the object library?
ans
no
no
note
Having some issues adding a .git file to a Xcode file that has been set to not have a .git
note
note
every view has 3 coordinate systems
note
There are 2 main graphics frameworks: UIKit, core graphics. They have different coordinate systems.
bug
Putting the initialization code in viewDidLoad did not do anything. The viewDidLoad method is never called.
The following SO thread helped me understand
the reason is that if you aren’t using storyboards the viewDidLoad method never gets called. This is true even if you alloc/init the viewController.
I was also confused about the difference between the UIViewController lifecycle and the UIView lifecycle. UIView has a method drawRect which is apparently where you are supposed to put all the drawing that is done on that view.
To Do
Understand why we need the drawRect method rather than just putting all the drawing into
There are 4 different possible ways to make our view controller visible.
task
make the button add another red block directly below the previous red block.
note
there is no reason a parent view should not know about all its children. i.e. they can be placed in the header.
Remember
- for some reason the length of an array is given by count.
- In objective C all library methods are responsible for allocating their return values.
- nil, nil, nil, nil, nil, nil, nil
q
If I allocate an array but assign no elements and then try to get the first element then what happens ?
bug
a runtime errror for trying to send the copy message to my custom UIView. Does not recognize copy.
q
is there anything bad about drawing the whole scene in loadView of the root viewController ?
I think this is fine.
If there was some common things that I wanted drawn on all my views then I would to this drawing by overriding the drawRect method of the custom view.
undeclared identifier error: first look if it is a property or a local variable of the method.
note
The first nontrivial statement in a recursive function is usually an if statement testing if you are in the base case of the recursion or not.
issue
Step 1: define the problem
My recursive function prints values for height,width,x start, y start. The x and y values of the start should both be 50. The value that is printed is 0 for both. So view was drawn in the wrong place because I was using a different coordinate system.
-(CGRect)convertRect:(CGRect)rect toView:(UIView *)view
solution
convertRect is a good way to convert something into the view's coordinate system.
note
CGRects are almost always used for frames.
note
CGRects are almost always used for frames.
the view that is a the target of the conversion operation is used as input. If view is nil then the method convert to base coordinates.
else both the view and the receiver have to belong to the UIWindow object.
there are 2 views involved.
This is sort of a projection operation. self is a view that we will project onto the other view.
Question
Give a high level explanation of what the appDelegate does.
No comments:
Post a Comment