0

I'm trying to program a stopwatch. In my AppController.m I can reset, start and stop a watch,... And in my TableViewController I have a array named "list", and all the items in the list get put into my TableView. Now I want to add the time from the stopwatch (AppController.m) into the array "list", like I can do with the button add inside TableViewController.h:

@implementation TableViewController

- (id)init
{
    self = [super init];
    if (self) {
        list = [[NSMutableArray alloc] init];
    }
    return self;
}

-(IBAction)add:(id)sender {
    [list addObject:[[TimeObj alloc] init]];
    [tableView reloadData];
}

I don't really have any idea how to do this, so I'm not sure if this is even possible. Do you know how to do this, or any other way to solve this problem?

WhatIsName
  • 2,294
  • 4
  • 24
  • 36
  • Have you modelled your stopwatch by some class? If so, you can just pass an instance of that class to the TableViewController. – HepaKKes Jul 07 '13 at 23:47
  • Hmm, but i want to add the newest time to the table View, if the User stops the Stopwatch. – WhatIsName Jul 07 '13 at 23:54
  • Frankly, I don't understand your problem: you should be able to instantiate any stopwatch object you want...Or I didn't get your question. Try to be more clear and post some code from you AppDelegate – HepaKKes Jul 08 '13 at 00:04

0 Answers0