Skip to content

Instantly share code, notes, and snippets.

@dutran90
Last active August 30, 2015 04:52
Show Gist options
  • Save dutran90/d5f7c5db0e15fcec7e72 to your computer and use it in GitHub Desktop.
Save dutran90/d5f7c5db0e15fcec7e72 to your computer and use it in GitHub Desktop.
UITableVIew
#pragma mark - UITableView Datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"ClubCell";
ClubCell *cell = (ClubCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ClubCell" owner:self options:nil];
cell = (ClubCell *)[nib objectAtIndex:0];
}
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 44;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"Row pressed!!");
}
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"myCell"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
cell.textLabel.text = self.justCourseNamesArray[indexPath.row];
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment