NSArray *itemArray = [NSArray arrayWithObjects: @"ON", @"OFF", nil];
self.snoozeSgCon= [[UISegmentedControl alloc] initWithItems:itemArray];
self.snoozeSgCon.frame = CGRectMake(15, 330, 280, 40);
self.snoozeSgCon.segmentedControlStyle = UISegmentedControlStylePlain;
self.snoozeSgCon.selectedSegmentIndex = 1;
[self.snoozeSgCon addTarget:self action:@selector(segmentActionSnooze:) forControlEvents:UIControlEventValueChanged];
[self.cell.contentView addSubview:self.snoozeSgCon];
-(void)segmentActionSnooze:(id)sender
{
switch ([self.snoozeSgCon selectedSegmentIndex])
{
case 0:
{
// code for ON BUtton
}
case 1:
{
// code for OFF BUtton
}
}
}