Próbuję przenieść UIRefreshControl na szczycie mojego headerView lub przynajmniej uzyskać go do pracy z contentInset. Ktoś wie, jak z niego korzystać?UITableView i UIRefreshControl
Użyłem headerView, aby mieć ładne tło podczas przewijania w TableView. Chciałem mieć przewijane tło.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Set up the edit and add buttons.
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.backgroundColor = [UIColor clearColor];
[self setWantsFullScreenLayout:YES];
self.tableView.contentInset = UIEdgeInsetsMake(-420, 0, -420, 0);
UIImageView *top = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top.jpg"]];
self.tableView.tableHeaderView = top;
UIImageView *bottom = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bottom.jpg"]];
self.tableView.tableFooterView = bottom;
UIBarButtonItem *leftButton = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"settingsIcon"] style:UIBarButtonItemStylePlain target:self action:@selector(showSettings)];
self.navigationItem.leftBarButtonItem = leftButton;
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addList)];
self.navigationItem.rightBarButtonItem = addButton;
//Refresh Controls
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(refreshInvoked:forState:) forControlEvents:UIControlEventValueChanged];
}
Wewnątrz normalnego kontrolera UIView nie masz self.refreshControl, więc całkowicie się mylisz obiektyw kamery – Godfather
świetna rada ... thx – paiego
Ta metoda ma pewne problemy, jeśli widok tabeli ma widok tytułowy (przynajmniej na iOS7). Gdy przewiniesz w dół podczas odświeżania, sekcje tabeli zostaną usunięte, przesunięte o wysokość widoku tytułu. – AlBeebe