Lecture 10_0(1)

Lecture 10_0(1) - CS193p Spring 2010 Wednesday, April 28,...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
CS193p Spring 2010 Wednesday, April 28, 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
To day ’s To pics UIScrollView inside a UIScrollView Especially if one goes horizontal and the other vertical only UITableView UITableViewDataSource UITableViewCell UITableViewDelegate UITableViewController Wednesday, April 28, 2010
Background image of page 2
UITableView Subclass of UIScrollView Displays a scrolling list of data in a single column Can display extremely large data sets efFciently Very common throughout the iPhone OS UI Wednesday, April 28, 2010
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
UITableViewStylePlain UITableViewStyleGrouped UITableView Styles Wednesday, April 28, 2010
Background image of page 4
Table Cell Table Footer Table Header Section Header Section Footer Section Plain Style UITableView Anatomy Wednesday, April 28, 2010
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Table Cell Table Footer Table Header Section Header Section Footer Section Grouped Style UITableView Anatomy Wednesday, April 28, 2010
Background image of page 6
Getting Data In How do you get data into the table? Don’t load it all at once That would be very memory inefFcient and memory is at a premium Instead, let table know how many sections/rows Then the table will ask you when a row appears And only then do you load up the user-interface for that row This all happens via delegation UITableView has two delegates, this one is called the dataSource (we’ll talk about the other delegate later in the slides) Wednesday, April 28, 2010
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
UITableViewDataSource How many sections in the table? - (NSInteger)numberOfSectionsInTableView:(UITableView *)sender; The default (if you don’t implement this method) is 1. How many rows in a given section? - (NSInteger)tableView:(UITableView *)sender numberOfRowsInSection:(NSInteger)section; This method is REQUIRED (obviously). As each row appears, load up its user-interface - (UITableViewCell *)tableView:(UITableView *)sender cellForRowAtIndexPath:(NSIndexPath *)indexPath; Also REQUIRED. But Frst, let’s look at the above process graphically . .. Wednesday, April 28, 2010
Background image of page 8
UITableViewDataSource How many sections in the table? - (NSInteger)numberOfSectionsInTableView:(UITableView *)sender; The default (if you don’t implement this method) is 1. How many rows in a given section? - (NSInteger)tableView:(UITableView *)sender numberOfRowsInSection:(NSInteger)section; This method is REQUIRED (obviously). As each row appears, load up its user-interface - (UITableViewCell *)tableView:(UITableView *)sender cellForRowAtIndexPath:(NSIndexPath *)indexPath; Wednesday, April 28, 2010
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
NSIndexPath Another class in Foundation Is basically a path of indices into a tree But for UITableView, it’s just section and row There are three special methods on NSIndexPath These were added just for UITableView
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

Lecture 10_0(1) - CS193p Spring 2010 Wednesday, April 28,...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online