NSTableView without scrolling, instead push down content below - objective-c

I would like to create a NSTableView so that when it grows it will not scroll but instead push down the content below. The NSTableView and the content below will be wrapped in a NSScrollView that will autoresize with the windows height.
Is this even possible? I've spent a lot of time searching for any answer or even a clue on how to approach a design like this, but no luck. Should I even use a NSTableView for this?
See this image if you don't understand what I mean:

I think that you just need to calculate the total height of your all table cells and that value set as a table height. After that set your scroll view content size as a CGSizeMake(scrolviewwidth, table_height)

Select tableView and in attributes inspector in section Scroll View uncheck Scrolling Enabled. It is possible, that you will have to set table height manually viz previous answer.

Related

NSFullSizeContentViewWindowMask and title/toolbar height?

I am attempting to implement something similar to Safari where the window's style mask is set to NSFullSizeContentViewWindowMask so the NSToolBar and title bar blur the background view.
This works fine, however I have a view that I need to not be clipped by the toolbar/titlebar, similar to how Safari's WebView has an initial top padding that doesn't cover the content when the view is unschooled.
My attempted solution was to create a dummy NSView which the unclipped views align their top value to, then changing the height constant of the dummy view to the height of the titlebar/toolbar. The issue, however, is that there seems to be no way to calculate the height of the toolbar.
This suggests that I calculate the height by subtracting the height of the contentView from the height of the window, but that only works (returns 0 otherwise as the two heights are equal) if I don't use NSFullSizeContentViewWindowMask which I want to use for the blurring effect.
Am I overlooking something simple, or is there no simple way to accomplish this?
Check NSWindow's contentLayoutRect property.

How to use Auto-Layout properly in this case?

I have a UIView and a UITableView. I'm trying to align them in a way so they are sticked to each other. The UIView has a fixed height and I want the UITableView to consume the rest of the horizontal space.
I applied a set of constraints which got me pretty close to what I want to achieve but there's a problem that I don't know how to solve. The layout is OK in the portrait orientation but there's a gap between the two elements in the landscape mode. Please see the screenshots below.
Here are the constraint setups for the elements.
UITableView: (all constants are set to 0)
UIView: (all constants are set to 0 except for Height)
Thanks in advance.
I had the same issue of that space appearing above the top cell of a UITableView.
Like yourself, I looked into the constraints and the properties of the table, though the only way I could fix the issue was to delete the UITableView altogether and re-insert it.
Once re-inserted the gap was gone.

Xcode UITextView Still not scrolling using storyboard

I am trying to initiate a scroll view in my UITextView and even though I seem to have selected the appropriate boxes, I can't seem to get the scrolling working. I have gone through multiple questions similar to this but none seem to have the answer.
I included an image of Xcode below:
Question 2: When I scroll down the majority of my text shows but the scrolling stops with two sentences or so left and I have to scroll down and hold it there to read. Any way I can fix this so it scrolls all the way to the bottom of the text?
Can you check the two boxes: Bounce Horizontally and Bounce Vertically and see what's happening? Sometimes your content are actually way bigger than your view, and they are touching a invisible outer box. If you can see they actually move, that means there is nothing wrong with touch or scroll, is just the view layout problem.
For the content issue, my guess is that the content size is not right, you can programmatically adjust it with textView.frame property, set it to a proper size, such as the frame of the window or the frame of the content, which are CGRect classes. Comment below to see if this can solve your second problem.
The text view will not scroll in storyboard, only the app. And the text view will scroll once the content in the text view exceeds the frame size.
If you're using iOS 7+, you can just turn on auto layout, pin each of the sides of the text view to the edge of its parent view, and it works fine without needing to do anything in code.

Expand UITableView to full size?

I have a UIViewController. Within it is a UIScrollView with several views inside it. At the bottom is a UITableView.
This UITableView is dynamic and will display either a small number or large number of rows. Either way, I want the UITableView to be displayed full size so the user can scroll down to the bottom of it using the parent UIScrollView, NOT the UIScrollView inside the UITableView.
I've attempted this by disabling scrolling for the UITableView (this works fine). I've then tried at runtime to expand the UITableView so that all rows can be displayed correctly.
However, this part isn't working. For some reason despite the UITableView being really big, not all the rows are being displayed.
I've expanded the UITableView like this:
CGRect frame = tableView.frame;
frame.size.height = 5000;
tableView.frame = frame;
What have I missed? Is there another view inside the UITableView which I need to expand for all the rows to be displayed?
Sorry if this was a silly question, I've only been using iOS for the last month.
Thanks in advance for any help :)
To clarify, this is a screenshot of the problem.
The red area is the UITableView, so it's definitely the correct size. However, there are supposed to be 10 table rows. There are only 5, even less if I increase the size of the table rows.
What do I need to do to display all the rows? What do I need to resize?
While I see you've managed to get it running, placing a UITableView within your own UIScrollView may mean the table view can't manage its content cells as efficiently as it can when it handles its own scrolling.
But, how can you add your own custom views and have them scroll with the table cells? By making them subviews of the UITableView. If you add one or two subviews to a UITableView, it positions them above and/or below its content, and scrolls them with its own cells.
The screenshot below shows how this looks in the XCode interface editor. Note that the root view is the UITableView, it contains two subviews for the header and footer, and those subviews can contain whatever subviews you need.
I managed to get it to work fine. However, I have no idea what the problem was in the first place.
I moved the UITableView higher up so it was covering the other views on the page. It displayed fine. I then moved it down to determine what was causing the problems, and it started displaying perfectly.
I'll put it down to an error in where I placed the UITableView, as I can't see any other issues.

Resize NSTableView or NSScrollView depending on number of rows in table

I have a view-based NSTableView which is embedded in an NSScrollView. It has custom cells that are x number of pixels high. The NSScrollView is the same size as the panel that it is a subview of. I want to resize the entire NSTableView depending on how many rows are in the table.
Everything is working except the resizing. Resizing the scroll view manually in IB seems to have the desired affect, but NSSrollView does not seem to have a class method to resize its view (like NSView has setFrame). Should I be resizing the scollview, the tableview, both, or something else? Does NSScrollView have a setFrame method or similar that I am missing?
Thanks.
Before you try to do it programmatically, make sure you have the outline view's autosizing masks set up properly in the nib file. It sounds like you simply want the outline view (and its scroll view) to always remain the same size as the window that it's inside.
By default, the autosizing masks of an NSScrollView/NSOutlineView combo that you place into a window looks like the following:
In other words, it's set up to always remain the same size as it is now, no matter how large you resize the window to be.
What you want to do is to change the autosizing masks to look like in the image below:
To do that, you click in the white autosizing box wherever there's a dotted red line to toggle it into a solid red line. Once it's configured that way, the scroll view (and table view) will always (automatically) be resized to be the same size as the window that it's in.
There may also be a way to achieve this using Lion's new "auto layout" feature, but I'll have to leave that to someone who has more experience with it.
In case you really need to do this (such as when you want all rows to fit in the scrollview alleviating the need to scroll) and the scroll view is only a portion of the window/view you can do:
[[myTableView enclosingScrollView] setFrame:newFrameRect];
scrollview.frame = CGRrectMake(x, y, w, h);