Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 165 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shrink large title when scrolling (not UITableViewController) iOS 11

#11
I used dsk1306 solutions, see above. But in my case I had a WebView in the UIViewController with the large title.

So I had to set the UIWebView ScrollView delegate:

self.webView.scrollView.delegate = self

and

extension MyViewController: UIScrollViewDelegate {

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
if #available(iOS 11.0, *) {
UIView.animate(withDuration: 0.5, animations: {
self.navigationController?.navigationBar.prefersLargeTitles = (velocity.y < 0)
})
}
}

}
Reply

#12
I've used something that is similar to [Kamil Szostakowski][1]'s answer for view with UICollectionView.

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
UIView.animate(withDuration: 0.5, animations: {
self.navigationController?.navigationBar.prefersLargeTitles = (velocity.y < 0)
})
}

It may be not so smooth but I haven't found better option yet.

[1]:

[To see links please register here]

Reply

#13
Have you tried something like this? It converts the large title display mode when the content is scrolled up.

class P1ViewController: UIViewController, UIScrollViewDelegate
{
var canTransitionToLarge = false
var canTransitionToSmall = true

func scrollViewDidScroll(_ scrollView: UIScrollView)
{
if canTransitionToLarge && scrollView.contentOffset.y <= 0 {
UIView.animate(withDuration: 0.5) {
self.navigationItem.largeTitleDisplayMode = .always
}
canTransitionToLarge = false
canTransitionToSmall = true
}
else if canTransitionToSmall && scrollView.contentOffset.y > 0 {
UIView.animate(withDuration: 0.5) {
self.navigationItem.largeTitleDisplayMode = .never
}
canTransitionToLarge = true
canTransitionToSmall = false
}
}
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through