Moin alle zusammen,
ich habe eine Frage zum refrehControl:
Wenn ich den TableView zum Refreshing runterziehe, soll der attributedTitle geändert werden in "Daten werden aktualisiert". Warum klappt das nicht?
Alles anzeigen
Gruß
Bernd
ich habe eine Frage zum refrehControl:
Wenn ich den TableView zum Refreshing runterziehe, soll der attributedTitle geändert werden in "Daten werden aktualisiert". Warum klappt das nicht?
Quellcode
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- ...
- UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
- [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
- refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Runterziehen zum Aktualisieren"];
- self.refreshControl = refreshControl;
- }
- - (void)refresh:(UIRefreshControl *)refreshControl {
- refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Daten werden aktualisiert ..."];
- ...
- NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
- [formatter setDateFormat:@"dd. MMMM yyyy, HH:mm"];
- NSString *lastUpdated = [NSString stringWithFormat:@"Letzte Aktualisierung am %@", [formatter stringFromDate:[NSDate date]]];
- refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastUpdated];
- ...
- [self.tableView reloadData];
- [refreshControl endRefreshing];
- }
Gruß
Bernd
Ich bin gegen Signaturen!!!