How to resize UIView with dynamic tableview in it? - uitableview

I am using storyboard.I used one UIButton to show/hide UIView and I already added one tableView to UIView and getting tableView and all.In tableView it is loading dynamic datas.But the problem is that UIView is not resizing with this tableView.I added few constraints and yet it is not working.Can somebody suggest an answer?

Related

How to put UIView inside of UICollectionView?

I want to put my UIView inside of UICollectionView(on top) that on scroll it scrolls with UICollectionView content. It's possible to put it on header part in UITableView, I did it, but in UICollectionView I cannot achieve the same effect. How can I do it?
I have created GitHub repo with sample. If anyone could help me with it.
In UITableView I add UIView inside of UITableView and it stays there, but in UICollectionView it stays behind of UICollectionView. I want that it(UICollectionView sections) will stay under the UIView and on scroll all(UIView & UICollectionView sections) will scroll together.
There is no such thing as collection view footer or header, because the layout can be very different depending on your needs, but, you have a couple of function that can help you for example:
registerClass(_:forSupplementaryViewOfKind:withReuseIdentifier:)
or
registerNib(_:forSupplementaryViewOfKind:withReuseIdentifier:)
depending if you are using a nib file or not.
I'm not sure but you will also need to provide the height of the view in the layout delegate
UICollectionViewDelegateFlowLayout
you can do this by dragging your UIView on to your cellidentifier of UICOllectionView
Like i did see in snapshot:
here View is my UIView which i added to UICollectionView and it scroll with the CollectionView

iOS Accessibility for CollectionView in a TableViewCell

I'm currently working on the accessibility of our project, and here is UICollectionView that is put into a custom UITableViewCell. This CollectionView has tens of cells that are arranged in multiply rows rather than one row.
It raises an issue that when you have voiceOver on and move the focus between the collectionViewCells by swiping left or right, the system thought you are swiping between tableViewCells, since collectionView is in the tableView, and the contentOffSet of the tableView will be changed according to the tableViewCell size, instead of the collectionViewCell size.
CollectionView is already put in the the tableView and I don't think I can change this. So just wondering has anyone met this case before and is there anyway to make the collectionView accessible as normal?
This is a known bug in Apple's SDK (sorry, I don't have a bug report reference) when nesting a collectionView inside a tableView. After some experimentation, I was able to work around it by using a UIView as a wrapper for my collectionView before adding it to my UITableViewCell's .contentView
UIView *wrapperView = [[UIView alloc] initWithFrame:cell.contentView.bounds];
wrapperView.accessibilityElements = #[collectionView];
[cell.contentView addSubview:wrapperView];
[wrapperView addSubview:collectionView];
Just fix the problem by reconstructing the whole page, here are 2 things do not do to make your app more accessible:
Avoid adding a subview directly to the tableView/collectionView like
[tableView/collectionView addSubview:yourSubView];
Avoid adding a vertically scrollable collectionView to a tableViewCell.
Adding a horizontally scrollable collectionView to a tableViewCell seems will not cause any issue.

UITableView within Subclassed UIView

I have a UIView that I subclassed to use as a slideout menu. Prior to trying to implement a tableview, I had programmatically added buttons with images and titles. It worked fine.
Currently I'm working with a subclassed UIView with a UITableView on top. I have a subclassed UITableViewCell and both subclasses have xibs.
The problem is that I can't seem to figure out how to have the tableview show up. I have the delegate methods in place as well as setting the tableviewcell as the dequeued cell.
The question I would like to figure out is how to get the tableview to show up. The background of the menu shows up but no tableview on top. Thanks for the help.

iOS: Stretching ImageView Above My TableView?

I have added a UIImageView on top of my tableView in storyboard & it works perfectly fine, except that when you scroll down, the imageView doesn't stick to the navigationBar and instead only sticks on to the tableView (revealing the view's background above it).
How would I get it to stick to both the tableView and the navigationBar, and just have the imageView stretch/zoom as the user pulls the tableView down?
This is how it's set up in storyboard:
And this is how I assign an image to it in my ViewDidLoad:
childHeaderView.image = [UIImage imageNamed:headerImage];
Any help would be greatly appreciated. I've tried setting constraints on it using autoLayout but it doesn't seem to let me (they're grayed out, even though I've enabled it for that ViewController).
The problem is that what you did in storyboard is adding the UIImageView as a header to your UITableView.
The proper way to do this is to add the UIImageView at the same level as the UITableView, which mean embed these two views inside a UIView.
Having a UIView as a root view for a view controller is unfortunately impossible for a UITableViewController, and I fear that this is your case. So you may want to replace your UITableViewController subclass by a UIViewController subclass.
EDIT: You'll want to set a fixed height constraint on your UIImageView, and add a vertical space constraint with a 0pt value between your UIImageView and UITableView.
Most of these can be achieved by moving view in IB.

TableView doesn't not scrolling and cells is not enabled

I've created UIImageView with tableView and put this view on another view. But my table isn't enabled. I can't press on the cell or scroll my table.
Try creating a UIView with your UIImageView and UITableView as subviews.
I don't think it's a good idea to have your table as a subview of an imageview.
I suppose you did this to have a background image for the table, but a transparent table with an image view behind can easily achieve this effect.
Do you have a UITableView as a subview of a UIImageView?
If that is the case then the problem is probably that userInteraction is disabled on your UIImageView (it is set to NO as default for UIImageViews).
You can try to set it to YES and see if you can interact with your UITableView. However I would not recommend this view structure as I don't believe it is intended to put UITableViews as subviews to UIImageViews

Resources