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
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
Background User Location When App Is Terminated/Suspended
How to Get Selected Text from Uitextfield in Iphone
Share Image with Hashtag via Uiactivityviewcontroller (Twitter, Facebook, Instagram)
Domain=Nsurlerrordomain Code 1202
Swrevealviewcontroller - Manually Switch to Another View
_Unused Flag Behavior/Usage (Gcc with Objective-C)
How to Loop Video with Avplayerlooper
Will Apps That Use Telprompt Be Rejected
Is -[Uitableview Reloaddata] Asynchronous or Synchronous
Avcapturevideopreviewlayer Landscape Orientation
In Os X 10.10 (Yosemite Beta), How to Test Using iOS 6.1 Simulator
Invalid Redeclaration in Auto Code Generate Nsmanagedobject Subclass Swift 3
Detect Uiimageview Touch in Swift
Orienting iOS Splash Image to Landscape/Portrait According to Launch Orientation
How to Detect a Dual Core CPU on iOS
Uitextfield Not Getting Keyboard Input
iOS - Uisplitviewcontroller with Storyboard - Multiple Master Views and Multiple Detail Views