Created
March 22, 2012 17:05
-
-
Save pablasso/2159752 to your computer and use it in GitHub Desktop.
Filling a UITableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to fill a table you need to implement the protocol UITableViewDataSource in the Header and implement this //methods: | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
#warning Potentially incomplete method implementation. | |
// Return the number of sections. | |
return 0; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
#warning Incomplete method implementation. | |
// Return the number of rows in the section. | |
return 0; | |
} | |
// Also implement this method to return the cell | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; | |
} | |
// Configure the cell... | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment