Can I have contentSize specific to a section in UICollectionView with my custom Layout - uicollectionview

I have a section which is scrollable horizontally with paging and other sections normal with vertical scrolling enabled in UICollectionView.
Now the thing is UICollectionViewLayout has contentSize property which is defined for whole CollectionView.
But I want only 1 section horizontally scrollable in vertical scrollable collectionViewLayout.
I know I can use another collectionView in a section to do this.
But can I avoid that??

No, the only way to do what you are trying to achieve is to use nested views. One way to do it is to use custom cells in a vertically scrolling UICollectionView, each of these cells contains its own horizontally scrolling UICollectionView. Presumably all but one of those will not contain enough cells to warrant any horizontal scrolling in that "row" of your outer view.
Since the outer view is vertically scrolling, you could use a UITableView for it instead of a UICollectionView.

Related

Can I embed a UIPageViewController in a UIPageViewController?

I have a UIPageViewController, which obviously I can set to horizontal or vertical scrolling.
My question is can I embed a UIPageViewController inside another UIPageViewController, and set one to vertical and one to horizontal, so that I have vertical scrolling through some categories, and then horizontal scrolling for objects in the categories?
If not, is there another way to do this?
Thanks
Yes, you can use nested UIPageViewController & both work fine and independently.look this link

iOS8 UITableView with autolayout has a blank space above cells

I've created a UIViewController in a storyboard using autolayout and it has an embedded UITableView. For some reason there is white space above the table view section. My expectation is that the tableview would split all available space into cells and have cells starting right from the top.
What is causing the table view to add empty space above the first section when using auto layout and size classes?
(See screenshot below, the white space beneath "television" and above "Prototype cells" is the problem)
I've examined the constraints and insets, and cant see anything wrong with them:
UPDATE:
Here's the scene hierarchy
Try toggling the UIViewController property in Interface Builder named:
Adjust Scroll View Insets
If you drag a view into the table view it becomes the tableviews headerview that gives a space similar to what you see. Could this be the issue? Your posted layout looks correct.
Alternativley If you click on the Watch view controller in the hierarchy and switch in the simulated metrics section the top bar property from inferred to translucent navigation bar and back again this seems to move the cells down in the tableview when it is set to a translucent navigation bar

Turn off animations when resizing row height?

I have an NSTableView which has custom row heights. I would like to temporarily turn off animations while I resize the heights. When there are many rows in view, or the user scrolls fast, the animation is just too much. How can I do this?
In the documentation for NSView you find
"- (void)setLayerContentsRedrawPolicy:(NSViewLayerContentsRedrawPolicy)newPolicy", what should fit to your needs.

Vertical scroll bar of tableview

I have a UITableView, upon which I have placed an UIImageView, which scrolls vertically when the table is dragged, up or down depending on how it is dragged. (The image is separate and has not relation to what is present cells of the table view.)
UIScrollViewDelegate has been used for vertical scrolling.
Is there any way, the image can be moved along with the vertical scroll bar when the table is dragged? If so, how can this be achieved?
I think what you want to achieve is something similar to the scroller of Path.app.
Hava a look at this control: http://www.cocoacontrols.com/platforms/ios/controls/knpathtableviewcontroller
It's Open source and achieves this.

Animating cells while UITableView is scrolling

I'm trying to achieve an effect wherein as a tableview is scrolling, the currently visible cells will animate according to where they are positioned on the screen. I'm somewhat new to IOS dev, so let me try to break it down:
Tableview loads with custom cells User begins scrolling While the
table is in motion, the visible cells have a UIView in which I would
like to perform an animation that corresponds directly to the cell's
current Y position on the screen.
Cells will ONLY animate when they
are visible
Cell animation directly corresponds to table motion, i.e.
whenever the table view scrolls, the cells are animating; once the
table stops, the animations pause
One solution I have thought of is to update drawRect every single frame when the tableview is moving. Depending on the graphic operations, this could be horrible performance wise. Is there a way to grab the current table position every time it changes? Would I be better suited to use Core Animation?
This might be helpful if you want to achieve something like below:
https://github.com/mrugrajsinh/AnimatedTableViewCellDemo
Make your view controllers the delegate of the UITableView, and use all the methods of scrollview Delegate also. There you have many controls for start scrolling and end scrolling, and within thpse controls you could check for uitableview cell positioning.
You have to become delegate to this: https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html
and this is the method to override and animate your cells:
– tableView:willDisplayCell:forRowAtIndexPath: