Prefer Large Titles and RefreshControl not working well
At the end what worked for me was:
In order to fix the RefreshControl progress bar disappearing bug with large titles:
self.extendedLayoutIncludesOpaqueBars = true
In order to fix the list offset after
refreshcontrol.endRefreshing()
:let top = self.tableView.adjustedContentInset.top
let y = self.refreshControl!.frame.maxY + top
self.tableView.setContentOffset(CGPoint(x: 0, y: -y), animated:true)
UIRefreshControl renders behind UINavigation w/ Large Titles
It looks like you are setting the refresh control after the large navigation has been configured.
Try changing the order to something like this -
override func viewDidLoad() {
super.viewDidLoad()
load()
configureTableView()
configureUI()
}
.......
func configureTableView() {
tableView.backgroundColor = .usingHex("fafafa")
tableView.tableFooterView = .init()
tableView.contentInsetAdjustmentBehavior = .always
tableView.refreshControl = .init()
}
func configureUI() {
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = "Latest content"
}
Xamarin iOS RefreshControl is stuck
It looks like the issue is related to the Refresh();
method being synchronous. You'll need to make this operation happen in the background so that the UI thread is free to provide the animation for the RefreshControl. For example:
private async void HandleValueChanged(object sender, EventArgs e)
{
ordersCollectionView.RefreshControl.BeginRefreshing();
ordersCollectionView.RefreshControl.AttributedTitle = new NSAttributedString("Refreshing",
new UIStringAttributes()
{
ForegroundColor = UIColor.Blue,
KerningAdjustment = 5
});
// await a Task so that operation is done in the background
await Refresh();
ordersCollectionView.RefreshControl.EndRefreshing();
}
// Marked async and Task returning
private async Task Refresh()
{
var viewModel = (OrdersViewModel)DataContext;
// Need to update this method to be a Task returning, async method.
await viewModel.OnReloadData();
}
The above code refactors what you had to use async/await and Tasks. You may need to refactor some more of your code to make that work, including the OnReloadData()
method.
There are lots of resources for getting started with Tasks, async and await. I can start you off with this reference from the Xamarin blog.
Related Topics
Macos, Swift 3: How to Get Data Back After Segue
Implement a Custom Staggeregrid in UIview Like Etsy App in Swift
Swiftui Navigationview Starting Inside Itself
It Is Posible to Load Customise HTML View into Webview in Swift
Pfuser That Created Object Cannot Delete Object Despite Acl Writing Access
When Creating Thread Safe Reads in Swift, Why Is a Variable Create Outside The Concurrent Queue
How to Rotate Text in Nsview? (Mac Os, Cocoa, Swift)
Navigation Bar Title View Missing in iOS11
Preparing for Swift 4 - Unsafemutablepointer Migration to Unsafemutablebufferpointer
Allow Siri Remote Menu Button When Play/Pause Button Is Overridden
Difference Between Timestamp Stored and Current Date
How to Set Window Level in Swift
Verifying The Purchase (Receipt) of Another Application (Mac App Store)
Skipnext Skipprevious Google Cast Greyed Out