Header Displaced in Tableview with Uirefreshcontrol

Header Displaced in TableView with UIRefreshControl

This could be an issue due to the fact that you are adding _refreshControl as a subview which is not supposed to be done. However you can create a UITableViewController object add it as the child view controller of your current viewcontroller class.

For eg:-

UITableViewController *tableViewController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
[self addChildViewController:tableViewController];

tableViewController.refreshControl = [[UIRefreshControl alloc] init];
[tableViewController.refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
tableViewController.tableView.frame = CGRectMake(...);//set the frame here
[self.view addSubview:tableViewController.tableView];

Put Pull to Refresh Control under TableView Header

Sample Image

1)adding header view inside uiviewcontroller not to headerview for tableview,

2)you can change the headerframe accord scrollView of the tableView contentoffset,It is a little complex

3) github.com/CoderJackyHuang/StickyUpDownDemo this demo you can learn to solve your problem

TableView with UIRefreshControl seems to glitch a bit when reloading?

Move the refreshControl.endRefreshing() into the completion handler of the function you are getting the data from.

Example:

func getRecentNotifs(limit: Int) {

// Get Data ...

Network.getData(limit: limit) { (data, error) in // Completion Block

// Update Table View
self.tableView.reloadData()

// End Refresh Control
self.refreshControl.endRefreshing()
self.activityIndicatorView.stopAnimating()

})

}

You were calling refreshControl.endRefreshing() in the refresh control's target method, so it was ending right away.

iOS plain tableview rows appear behind header

Is this a tableview header or a sectionview header? If sectionView header, that's the default behavior. To make an optical illusion, just set the background color of the view for the section header to be that purple color

you have to use:

viewForHeaderInSection and heightForHeaderInSection. Google for examples of these



Related Topics



Leave a reply



Submit