UICollectionView vertical scroll last item - uiscrollview

Hi I have a vertical UICollectionView that works just fine, but the las item is barely visible and you have to pan up the scrollview to fully be able to see it, when you stop panning the item bounces back and you can almost interact with it.
I've tried with the bounces properties in the collection view's properties for scrollview in interface builder, but it's still the same.
Should I have to increase "manually" the scrollview's contentsize in order to let me interact with this item?.
You can barely see in the following screenshot, at the bottom just below 25th July

Just a guess here, but maybe your navigation bar is "pushing" your UICollectionView down.
Are you sure the frame of the UICollectionView is right? Maybe it is extended off screen.

Related

UIScrollview scroll not working

UIScrollview scroll is not working when i tested application in device (iPhone 5), But scroll is working properly in iPhone 5/5s/6/6 Plus simulator. I am developing application using Xcode 6 and UIStoryboard with AutoLayout.
I set the top, bottom, left and right constraints of UIScrollview with relative to Superview. And i also set the constraints of every UIControl which is in the UIScrollview.
Has any one have solution regarding this issue?
Please see below screenshot for reference.
It's probably easiest to have the scroll view contain a single view, which then contains all of your scrollable content. That single view should be anchored to all 4 sides of the scroll view, and if it's only meant to scroll vertically (which is what your screenshot makes it look like), then set the content view to be the same width as the parent of the scroll view.
To make sure an UIScrollView scroll, you have to check
Size
Your content View is bigger than your Scroll View. If you want it to be scrolled vertically, make sure its higher; horizontally, wider.
Constraints
Make sure your Scroll View is pinned to its super view, Top, Bottom, Leading, Trailing.
Make sure your Content view of Scroll View DOES NOT have CenterY constraint set to Scroll View, cause that'd make content view stuck with Scroll View and it'd never be able to scroll. (That happens to me the last time I was stuck)
Interface Builder settings
Make sure the check in Interface Builder under Scroll View is checked:
Scrolling section, Scrolling Enabled.

Setting the scrollable area UISCrollView

I tryed to use answer it this quiestion Limiting the scrollable area in UIScrollView however i didnt succeed in my problem.
I have a UIScrollView that contains 3 UIView one after another. When I press on the UIView I add a UITableView under UIView i pressed. At this moment I need to limit scrolling area, so I could scroll only this TableView and UIView.At another press on UIView I hide the UITableView and I can scroll further in horizontal direction. My question is - how its possible to implement scrolling only in that area I described? Only thing I know is I have to change contentSize of my UISCrollView, but when I do it I get to the beginning of UIScrollView.

Resize animations on a scrollview

I am trying to create a resize toggle animation on this simple custom TUIScrollView class (from TwUI open source project and very similar to UIScrollView) that I have built. It is called TUILayout and supports horizontal layout as well as vertical, animated insertions and removals and has a more declarative way of supplying data to it's cells that I prefer over delegation. It recycles views similar to TUITableView or UITableView. Anyway if you want to follow along, it's just one class and is here.
https://github.com/mrjjwright/TUILayout.
In the example code, the user clicks the blue button in the lower left and all the rows shrink smoothly to a size where the user can reorder and delete some rows (right click on a row in the example to see this in action), etc... and then the user toggle the rows back out to their original size by clicking the blue button again.
While doing this resize in setObjectHeight:animated I first resize my model objects that represent the rows, recalculate and set the contentSize on the TUIScrollView, cycle in all the new views (say 10 more views will fit in the shrunk view so dequeueReusableView and addSubview gets called 10 times) and finally I animate the frames of all the views to their size and location in layoutSubviews.
The result is that the scrollview correctly shrinks to a size where the scrollbar no longer displays, the views that are on screen animate smoothly down to their reduced size, but the newly added subviews that can now fit in the visibleRect animate in much later as one block of subviews.
So all the newly added subviews lag behind the views that were on the screen and I can't figure out why the animation isn't all happening together. I have tried lots of different combos of things with no luck including CATransactions. I am wondering if it has to with how a CAScrollLayer works or if somebody can help me think through this.
The more general issue is how to smoothly handle resizing animations on scrollviews that recycles their views and I have looked at several other grids out there in the iOS world and have got some inspiration but am looking for more.
Thanks!
I think I might have solved my own issue here (as I was making my bed this morning it hit me). I forced the current runloop to run after cycling in all the necessary subviews and very importantly not setting the contentSize of the scrollview until after the run loop completes and adds the needed subviews for the animation. In order to get the run loop to fire I used the trick from this SO question:
skipLayout = YES;
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate: [NSDate date]];
skipLayout = NO;
If skipLayout is set TUILayout just returns from layoutSubviews so that the views just added are not immediately removed by the recycling layout code. Forcing the run loop to run made sure that all subviews were on the screen for the animation. After this I performed the resize animated layout. I updated the code on github if anybody is interested. I will leave this question open for a while to gain some further insight.

UIScrollView created in Interface Builder scrolls out of the view

I'm trying to create a scrollable area in the middle of the screen - above it are a few non-scrolling labels, and below it are some non-scrolling buttons, so I only placed the UIScrollView in interface Builder in the middle of the window. I set the outline of the UIScrollView to be the full width of the iPad, 768 pixels, and about 700 pixels high.
I can place other UI elements within the UIScrollView as children of it, and I can scroll those by setting (in the view controller):
#define SCROLL_AREA_VERTICAL_HEIGHT 1200
...
[myScrollView setContentSize:CGSizeMake(768, SCROLL_AREA_VERTICAL_HEIGHT)];
[myScrollView setNeedsDisplay];
When I look at this in Interface builder, it seems to work, I can see only the UI elements that happen to fit with in the 700-pixel or so frame of the UIScrollView as set in Interface Builder. When I actually run it, though, I can see the UI elements that should be hidden below the lower boundary of the UIScrollView frame, and when I scroll up, the elements at the top don't become hidden by the top edge, but rather move up and over the labels on the top that are supposed to be static. In other words the boundary of the scroll area isn't actually hiding the elements that scroll off of it. What am I doing wrong?
Well i had a problem that was a bit like yours, don't know if it would work for you but try selecting the view in interface builder, and in the atributes inspector there is a box with a checkmark that sais clip subviews, check it and try. That was the solution for me. Hope it helps.

Why would NSWindow with NSTableView not resize?

Here is my IB setup:
http://img145.imageshack.us/img145/5929/picture1gxr.png
When both NSScrollView and NSTableView are set to autoresize and autofill (all the arrows in the Autosizing section are checked) my window does not resize. Actually it resizes, but by a pixel, as if it remembers that it is not supposed to resize after I start dragging the corner. If I uncheck the autofill arrows (disabling NSViewWidthSizable and NSViewHeightSizable) on the NSScrollView, the window resizes fine, but of course, the scroll view does not resize with it.
The weird thing is that in the situation where the window is "rigid" if I resize one of the NSTableView's columns beyond the view (thus causing a horizontal scroll bar to appear), I can resize the window but only until it reaches the size big enough to accommodate all the columns and then becomes rigid again.
Maybe you have set a fixed minimum/maximum size for the window?
Is this a feature or bug of BWSplitView? What if you make it an NSSplitView?
If it turns out to be a bug, you should report it.
Ah, I've reverted to my last good commit and rebuilt the view hierarchy and everything worked. It is probably a bug in BWSplitView, but I can't reproduce it anymore, so can't report really.

Resources