UIRefreshControl을 내 headerView 위에 이동하거나 최소한 contentInset과 함께 작동 시키려고합니다. 누구나 그것을 사용하는 방법을 알고 계십니까?UITableView 및 UIRefreshControl
TableView 내에서 스크롤 할 때 멋진 배경을 사용하기 위해 headerView를 사용했습니다. 나는 스크롤 가능한 배경을 갖고 싶었다.
- (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];
}
내부 UIViewController 당신은 self.refreshControl이 없으므로 완전히 잘못되었습니다. lensovet – Godfather
위대한 조언 ... thx – paiego
이 tableview는 titleview (적어도 iOS7에서)가 있으면 몇 가지 문제가 있습니다. 새로 고침하는 동안 아래로 스크롤하면 표 섹션이 제목보기의 높이만큼 오프셋되어 모두 벗어납니다. – AlBeebe