Wednesday, 15 April 2015

April 14

Erik "Cultivating online presence
LinkedIn endorse classmates on skills
LinkedIn groups
Twitter: use hashtags to reach more people

> Slides are online

#
[someObject foo:nill]
we have the same situation in which Java will produce a NullPointerException. 

The nil object will be accessed first at [anArray count] However, instead of throwing a NullPointerException, Objective-C will simply return 0 in accordance with the rules above, so the loop will not run. 
However, if we set the loop to run a set number of times, then we're first sending a message to anArray at [anArray objectAtIndex:i];
This will also return 0, but since objectAtIndex: returns a pointer, and a pointer to 0 is nil/NULL, NSLog will be passed nil each time through the loop. (Although NSLog is a function and not a method, it prints out (null) if passed a nil NSString.

For some reason NSLog prints the nill pointer as nil.


# An example of sending a message to the nil pointer.
NSString* string1=nil;

int y= [string1 stringByAppendingString:@"a"];
The compiler gives a warning about type conversion. But the value of y will be 0.

#
ObjC lec 1
strong means “keep this pointer in the heap as long as I or anyone else have a strong pointer to it”

In ObjC you can send a message to a _nill pointer.

NSString* astring;
[astring 

#
What is IBOutlet
An indicator. 

#
The prototype cell is associated with the UITableViewCell.
Have to change it to CustomTableCell class.

the method dequeueReusableCellWithIdentifier:cellIdentifier returns the “default” cell UITableViewCell. We have customized this to CustomTableViewCell. So we are responsible for casting this return to the new cell type.

in chapter 5 we want to respond to the user touching the screen.

More delegates!
We use UITableViewDelegate in order to handle cell selection
Data sources are an example of delegates

The following 2 methods are used for the selection of a particular row
-tableView:willSelectRowAtIndexPath:
-tableView:didSelectRowAtIndexPath

4:00pm
Look at the UITableViewDelegate
Look at “Managing Selections”
we have willSelectRow and didSelectRow
these are the methods we are going to implement

UITableViewController already adopts the UITableViewDelegate protocol.
This means that any of that delegates methods can be completed.

A table cell in Basic style has 3 parts.

The following 2 lines of code are used to make a check mark at the end of the line
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]
cell.accessoryType = UITableViewCellAccessoryCheckmark

a cell has some accessories available to it.
need to select one of these.


No comments:

Post a Comment