Skip to content

Instantly share code, notes, and snippets.

@dewski
Created August 7, 2009 05:53
Show Gist options
  • Save dewski/163751 to your computer and use it in GitHub Desktop.
Save dewski/163751 to your computer and use it in GitHub Desktop.
- (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] autorelease];
}
if(indexPath.section == 0) {
UIView *seggedView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 64)];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Easy", @"Medium", @"Hard", nil]];
segmentedControl.selectedSegmentIndex = musicStore.difficulty;
[segmentedControl addTarget:self
action:@selector(updateOptionDescription:)
forControlEvents:UIControlEventValueChanged];
segmentedControl.frame = CGRectMake(9, 0, 302, 44);
[seggedView addSubview:segmentedControl];
[segmentedControl release];
[cell addSubview:seggedView];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
} else if(indexPath.section == 1) {
cell.selectionStyle = UITableViewCellSelectionStyleNone;
switch (musicStore.difficulty) {
case 0:
cell.textLabel.text = @"All Information";
break;
case 1:
cell.textLabel.text = @"Song Title and Artist Name";
break;
case 2:
cell.textLabel.text = @"Song Title";
break;
default:
cell.textLabel.text = @"Description of setting";
break;
}
} else if(indexPath.section == 2) {
cell.textLabel.text = @"Start Playing";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment