I want to display navigation bar on screen gradually when user scroll on screen. and Want to make it alpha to hide navigation bar (Setting Alpha because i want to show back arrow of navigation controller).
While scrolling upwords its fine.
But while settling scrollview at initial position if i set its translucent property is true i.e. NavigationController.NavigationBar.Translucent = true; then it shifts content upwords with the same height of navigation bar.
Expected Result : Scrollview should be at initial state after scroll completion.
Can anyone please help me on this ?
If you have enabled the AutomaticallyAdjustsScrollViewInsets
on iOS 10- or ContentInsetAdjustmentBehavior
on iOS 11 and you have added the correct constraints for your scrollView. The scroll view will auto adjust its insets to make the content show under the NavigationBar.
But If you set the NavigationController.NavigationBar.Translucent = true;
and use MyScrollView.SetContentOffset(new CGPoint(0, 0), true);
to set scrollview at initial position. This will cause your issue: the content seems covered by the Navigation Bar.
You can use another api the make the scroll view scroll to top:
MyScrollView.ScrollRectToVisible(new CGRect(0, 0, 5, 5), true);
This will place the scroll view's content below the navigation bar. Or try to judge the Translucent
state, if this is true use this to get back the initial place:
MyScrollView.SetContentOffset(new CGPoint(0, -NavigationController.NavigationBar.Frame.GetMaxY()), true);