I want to add a object in my tableview to dynamic insert rows.
The code seems not to be working, no row is inserted.
Code:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *newString = @"test!";
[self.greekLetters addObject:newString];
}
- (NSInteger)tableView:(UITableView *) tableView numberOfRowsInSection:(NSInteger)section {
return [self.greekLetters count];
}
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
NSString *SimpleIdentifier = @"SimpleIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleIdentifier];
if (cell == nil) {
cell = ([[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:(SimpleIdentifier)]);
}
cell.textLabel.text = [NSString stringWithFormat:@"%@", [self.greekLetters objectAtIndex:indexPath.row]];
cell.detailTextLabel.text = @"Laatste datum";
return cell;
}
The object isn't adding to the textlabel text and it hasn't a new row. I am new to this sort of iOS, so what's wrong with the code?
I tried many things but can't get it to work.
Thanks.