//
// TimerViewController.h
#import <UIKit/UIKit.h>
#import "StaticClass.h"
#import "TimeOptionController.h"
@interface TimerViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
NSMutableArray *sections;
NSDateFormatter *formatter;
IBOutlet UITableView *tvc;
NSString *duration1;
}
@property (nonatomic, assign) NSDateFormatter *formatter;
@property (retain) NSMutableArray *sections;
@property (nonatomic, retain) UITableView *tvc;
@property (nonatomic, retain) NSString *duration1;
-(IBAction)startTimeBtnPressed;
@end
//TimerViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
if(indexPath.section == 0){
cell.textLabel.text = [sections objectAtIndex:indexPath.row];
cell.detailTextLabel.text = duration1;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
//TimeOptionController.h
#import <UIKit/UIKit.h>
@interface TimeOptionController : UITableViewController {
NSArray *rows;
int selectedRow;
NSString *duration;
}
@property (retain) NSArray *rows;
@property (nonatomic, retain) NSString *duration;
@property (nonatomic, retain) NSString *duration1;
@end
//TimeOptionController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
selectedRow = indexPath.row;
duration = (NSString *) [rows objectAtIndex:indexPath.row];
duration1 = duration;
[self.tableView reloadData];
}