Top offset of TableView embeded in Navigation Controller in storyboard - xcode

I have custom TableViewController with plain style Table View and it is embeded in Navigation Controller. I use Refresh Control on the table view and Black Translucent style of the navigation bar and all is setup in storyboard.
The first row of the table view starts right under the navigation bar item, which is ok, and the rows can scroll under the navigation bar which is semi transparent. When user starts to pull the table down to activate Refresh Control, the animation of the refresh object obviously starts at the edge of the screen under the Navigation Bar, and so the refresh object is always partially covered by the navigation bar which can confuse inexperienced users.
Is there a way to tell the TableView to avoid scrolling under the navigation bar and start the refresh control object animation right under the navigation bar? I tried to play with Scroller Insets on table view without any effect.
Thank you.

If you go into the properties for the tableview controller in your storyboard, you can change the size and positioning of the tableview to start after the navigation bar. The problem isn't an offset, but the size and position of the tableview itself. Just move the y position down to accommodate the nav bar.

Related

How to show scroller indicator in NSTableview when scrolling , hide when not scrolling

I am new in MacOS ,I want to show scroller indicator in NSTableview when scrolling , hide when not scrolling.
I am thinking to get the delegate of NSScroller , So i can detect when it scrolls,then hide/show it . Please help
Per the NSTableView reference page:
Table views are displayed in scroll views.
A table view itself doesn't know how to scroll. You have to put it inside a scroll view in order to scroll the table. If you're used to iOS and UIKit, that's a difference; UITableView inherits from UIScrollView, so on that platform a table view is a scroll view. In a MacOS project, if you insert a table into a view in Xcode's nib or storyboard editor, Xcode will actually insert a scroll view that contains a table view so you'll already have what you need. If you're creating the table in code, you'll need to also create the scroll view yourself.
Looking at NSScrollView, there's a property called autohidesScrollers which is...
A Boolean that indicates whether the scroll view automatically hides its scroll bars when they are not needed.
So, to get the behavior you're asking for, you need to set the scroll view's autohidesScrollers property to YES.
Of course, you can set that in the storyboard editor too, but again you need to look at the options for the scroll view, not the table view:

UIScrollView contentInset is set to nonZero when using autolayout

So I have the following view hierarchy :
A full size scrollView in my viewController's view with the following constraints :
These are the constraints on containerView (ignore the second last one, its a hacky semi-fix for my problem):
I have the status bar, the navigation bar and the tab bar visible.
The thing is that when I set a breakpoint to check the scrollView's contentInset, it shows 64 on top and 49 on bottom, left and right are zero.
There is no way to set contentInset in IB, I tried setting it in an IBAction to UIEdgeInsetZeio, but that didn't fix it either. This is screwing up my scrollview by adding space above and below my contentView, how can I fix this?
By default the view controller extends the view under the top navigation bar so your content will blur under a translucent navigation bar. This is controlled by edgesForExtendLayout which is managed in Storyboard via the Extend Edges setting.
By default, the scrollview will automatically adjust its content inset so the content appears below the top layout guide. This is controlled by automaticallyAdjustsScrollViewInsets which is also managed in Storyboard.
What you did was constrain the top of your scroll view to the top layout guide instead of the top of its superview. By doing this, you manually offset it by 64 points. However, the scrollview is still automatically insetting its content by 64 points, which is why you're seeing additional space above and below your scroll view.
Either constrain your scrollview to its superview (so its content scrolls under the top/bottom bars), or disable the view controller from automatically adjusting the scroll view inset.

iOS TableViewController Scrolling away content and navigation bar under status bar

I'm using a TableViewController and I've added my own navigation bar on top to match the other tabBar pages that I have.
I had to place at the top an empty view to lower the starting point of the table view so it wouldn't cover my navBar, which was already annoying.
Now it looks fine except that when I scroll up my list both navBar and TableView go under the status bar.
I want my navBar to stay where it is and the TableView not to go under the status bar when scrolling.
For starting I can't add any other stuff in my scene if not under the table view and i get that that's causing the nav bar to follow the tableview up so that's part of the problem..
Xcode 7.1 swift 2.0 iOS 9
When creating this kind of structure (table + other elements), the best approach is to actually have a ViewController that contains a TableView and additional elements (like your navigation). Do not try to put elements, that are not part of the table itself inside the table.
Here is an example of the structure, where I have intentionally coloured the custom view (in your case the navigation) orange. As you can see, it is outside the table. This way the showing and scrolling of the table is completely separated from the other elements.
you can try self.edgesForExtendedLayout = UIExtendedEdgeNone;

UIScrollView not scrolling after navigating back to view in ios7

I have a project I was working on in XCode 4.whatever where the main view is a Netflix-style layout with a series of horizontally-scrolling scrollviews. The main scrollview may be scrolled vertically to see all of the horizontal ones. This is connected to a navigation controller so when an item is touched it performs a segue, whereupon the user can click a standard navigation bar back button.
This was working as expected with XCode 4.*, iOS 6.1. I have now upgraded to XCode 5 and iOS 7. The scrolling works fine upon initial load - the main vertical one and subview uiscrollviews. After navigating to an item and touching the back navigation bar button the main view won't scroll vertically. The subviews that are visible still scroll horizontally.
I am using a storyboard. The master view controller contains a Scroll View as the top item and a View with a couple subviews for the feature section at the top. The horizontal scrollviews are added programmatically.
The master view controller is a UIScrollViewDelegate and I have connected an IBOutlet from the main scrollview to my master view controller .h file.
That it works initially and then stops scrolling leads me to believe that the content size is being recalculated - and set equal to the frame size - after the navigation. However, I tried setting the content size within viewWillAppear to no avail. I did verify the routine was being called after navigation.
Any ideas on why the main scroll view loses its scrolling?

Xcode tableview hidden behind navigation bar

Can anyone please tell me how to fix the following issue.
I am building an iPhone app using Storyboard. I have a Navigation Controller as root view and off that a view controller. On this I have a few buttons that when clicked takes you to a table view controller. All fine and well, but when I link the buttons to their respective table views, the top navigation bar obscures the top cell in the table view controller.
Does anyone know why this is happening and how I can fix it?
Also it seems to have thrown off my layouts from the view controller from which they inherit.
See attached image for a better explanation perhaps.
I believe this is the intended behavior when using the translucent navigation bar. It's semi transparent specifically so that you can see items pass behind it (e.g. a table scrolling). If you don't want this, changing the navigation bar's style to opaque should solve the problem.
Since I wanted to keep the translucence, I just added a UIView between the navigation controller and the prototype cell (width of the view, height 60). That way the first cell in the table starts beneath the navigation bar but I can still see the scrolling underneath.
This is a bug/feature in IB when you use a translucent navigation bar, the content view runs under the navigation bar. For non transparent bars the content view begins after the bar. If your content view is a UIScrollView (UITableView is a descendent of UIScrollView) the content will be automatically scrolled so as to not be hidden under the navigation bar. So the problem only exist in IB when you run the app everything should be ok.
You just need go to the Navigation Controller properties, then Simulated Metrics, and change the Top Bar to be a Transluscent Navigation Bar WITH PROMPT. And that should be it. No need for that extra UIView

Resources