UPDATE: The problem is kind of resolved. I put everything from my functions class directly into my myView class.... now works like a charm. Don't exactly know why, but it does. Maybe some of you could speculate on that. I'd welcome any help.
------
I thought myself at least an advanced programmer before objective-c... I just started coding apps and it went quite ok so far. But now I'm in a bit of pickle. See, I have a UITableView whose data is supposed to update periodically. My app gets its data from a webserver and stores it into an array. so far so good - all that works according to NSLog outputs. The UiTableView EVEN UPDATES when I put the [myTable updateData]
into a button action. But when it's called out of another method, it does nothing...
My code so far (abbreviated): myView.h:
@interface myView : UIViewController <UITableViewDataSource, UITableViewDelegate> {
@public
IBOutlet UITableView *myTable;
}
- (void)reloadMyTable;
- (IBAction)testbtn:(id)sender;
@end
myView.m:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section
{
Model *model=[Model getInstance];
return [model.ARrecentnews count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return numberOfSections;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection: (NSInteger)section
{
return @"Some Headline";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellID"];
Model *model=[Model getInstance];
cell.textLabel.text = [model.ARrecentnews objectAtIndex:([model.ARrecentnews count]-indexPath.row-1)]; //Populating Table in reverse order
return cell;
}
- (IBAction)testbtn:(id)sender {
[myTable reloadData];
}
- (void)reloadMyTable {
[myTable reloadData];
}