I have a UiView that contains a CollectionView for images of a kind of products and a TableView that contains cells with images and labels of another kind of products.
What I'm trying to do is give this UIView a scroll, showing of the images of the first CollectionView unfolded, and scrolling down show all the TableViewCells unfolded, not with his own scroll in their section.
I have tried embedding the two sections into a scrollView but this doesn't worked.
What could I do?
Any reason why you picked a UIView instead of a UIScrollView? Seems like a scrollview would solve your problem.
Related
I have collectionview with horizontal flowlayout direction and size of a UICollectionviewcell is screen size. Is it possible to scroll vertical if content of cell exceeds the screen size height?
Yes you can. I think, iPhone Youtube app is created in the same fashion!! :)
You can create a CollectionView controller with its collection view set to horizontal scrolling, set the collectionView cell size to the screen size. And set the paging enabled property of collection view to
true.
THis will allow you to scroll horizontally as if each cell was a page itself.
Next up, you can add another collection view to each of these cells, with vertical scrolling property of this collection view.
THis can be achieved very easily by subClassing UICollectionViewCell of the CollectionViewController. In the subclass, each cell must have a UICollectionView property.
Remember that the UICollectionView in each cell will have to have delegate and datasource set up properly.
This is exactly what you are looking for.
Source of all information is within this link just above. Hope this helps
I've a simple UICollectionView with the CHTCollectionViewWaterfallLayout and 3 cells with a height between 300 and 400 pixels. The cells contain a view from a UIViewController which has a non-scrollable UITableView as subview.
It's all shown correctly but there is one problem. If I scroll to the bottom of the collection view on the iPhone and let them bounce one time, the last 2 visible cells disappear.
The cells are not higher than the screen of the iPhone. I also tried this in viewDidLoad:
if ([self respondsToSelector:#selector(setAutomaticallyAdjustsScrollViewInsets:)]) {
self.automaticallyAdjustsScrollViewInsets = NO;
}
It doesn't change anything. The views in the cells are inserted by code, there isn't a XIB or storyboard for the cells. If I remove the line to insert the views the cells are still visible while and after the bounce. Does this mean it's a problem inside the UITableView?
Do you have any suggestion for me?
Thank you!
EDIT: The problem also reproducible when I hide the UITableView inside the subview.
I have a UITableView embedded in a UIViewController. The TableViewCells are rows for the user to select something, so when they touch it a checkmark appears, heres where my question comes in:
I dont want the UITableView to scroll in its window, I want the TableView to grow with the items it contains. Do I need to put a scroll view on the UIViewController and then the TableView on that? Or will the ViewController scroll if the content is bigger than the View?
Also, Im not even sure where to start with changing the height dynamically of the UITableView, everywhere I look its about changing the cell heighets dynamically.
Please Help! Thank you!
self.tableView.scrollEnabled=false;
stops the scrolling
self.tableView.frame=CGRectMake(0, 0, (float)width, (float)height);
sets the size of your tableview
But I don't understand why you want to stop tableview scrolling and to scroll the whole view....
I am making a custom cell which has text fields and as a result the custom cell is greater than the size of the iphone screen.But i am not being able to do horizontal scroll to reach the end of the cell.
I have tried using viewController and adding table view to it as well as creating table view controller and adding custom cell to it.
when doing it through TableViewController,I am not able to horizontally scroll it,whereas i am not getting how to add Custom cell class to the tableView object placed in viewController.I know that UITableView is a subclass of UIScrollView but not able to implement it.Please help.
Thanks
as per the documentation at
A table view in the UIKit framework is limited to a single column
because it is designed for a device with a small screen. UITableView
is a subclass of UIScrollView, which allows users to scroll through
the table, although UITableView allows vertical scrolling only.
so as desired in your case you will have to take some other approach. Now using Custom cell with TextFields should not actually need you to require Horizonatl scrolling. If the text is really large you would like to consider using TextView instead of TextFields.
Hope it helps
Ideally, you should be truncating your text. But if it is important for you to display the entire text, add a scroll view as a subview (or set it as the content view) and add your labels to the subview. Each cell will then be individually horizontally scrollable.
i've got a tableview. inside this, i have a tableviewcell with a horizontal scrollview inside it.
it works fine, but if i start scrolling horizontal inside a tableviewcell and move a bit up or down, the horizontal scrolling stops and the tableview gets scrolled.
is there a way to prevent the tableview from scrolling while scrolling horizontal inside a tableviewcell?
thanks for all help
try scrollView.canCancelContentTouches = NO
If that doesn't work you may have to do more complicated handling of touch events by subclassing UIScrollView. (Look at touchesBegan:event:, touchesMoved:event:, touchesEnded:event:, touchesCancelled:event:)
you should not put the UIScrollView inside an UITableView. you could show the content of your cell vertically Or show on the details view
UITableView is a subclass of UIScrollView.
Form Apple Documentation.
Important: You should not embed
UIWebView or UITableView objects in
UIScrollView objects. If you do so,
unexpected behavior can result because
touch events for the two objects can
be mixed up and wrongly handled.
More