In a xib file, i've got a UiCollectionView. I would like to add a header to this UiCollectionView.
According to this article :
Next, open up MainStoryboard.storyboard and click on the collection view inside of the Scene Inspector on the left (you might need to drill down a couple of levels from the main view first). Open up the Attributes Inspector and check the Section Header box under Accessories:
If you look at the scene inspector on the left, a UICollectionReusableView has automatically been added under the Collection View.
I did it, but when I look at the screne inspector on the left, there is no a UICollectionReusableView.
Any suggestion ?
How I correct the problem:
Be sure your UICollectionView delegate is linked with File's owner in xCode.
Related
I created a project in Swift. I added view controller file and one XIB using right click on the project - > Add Files to projectname -> Empty (xib) file.
After adding the xib file, i removed the view and added View Controller. Under the View controller , i have added few button. But i am not able set the constraints.But if i add the View object instead of View Controller, i am able to set the constraints. I don't understand why the xib constraints are disabled for View controller. Attached the screen shot
Layout is set to Translates Mask Into Constraints, meaning that IB is gonna generate the constraints for you automatically.
Set it to Automatic and it'll work.
I am trying to add FooterView(UIView) by dragging down on UITableview through XIB but can't.
Yes we can add it programetically (tableView.tableFooterView = myView) & also works with dragging view in Storyboard,
But I want right from XIB.
You cannot do this in a Xib. If you think about it, a storyboard is somewhat like a collection of Xib files. Thus, in a storyboard you can add a footer view as a kind of 'xib' embedded in that storyboard. A pure xib cannot contain multiple child xib's, so what you want is not possible unfortunately.
I am trying to put a footer view into my UICollectionView in Storyboard but when I click the footer view radio button, the image for the collection view updates but no views are added to the hierarchy as you can see in the image below. What am I missing?
After you check "Section Footer" checkbox (not radio button) Collection Reusable View item should appear inside Collection View hierarchy which is in the left panel. Now I am not seeing it at all in your panel. Something is wrong with your collection or your Xcode. For example in my XCode 7.2, when I check both header and footer checkboxes, collection view hierarchy looks like this:
Try to update your Xcode or create new storyboard file.
Now the situation is illustrated in this image:
I have an app having multiple Xib files calling in one main Xib and its class. I have added expand and collapse view which works on particular xib expand and collapse subviews as required and reduces/Expands Height too.
This works well for one xib section when all tabs of xib files are collapsed and the second xib won't change its y-coordinates, but I'm having a white space between. I want to fix it.
Note: Every xib contains a class referring to it. The whole app won't use auto-resize.
How can I solve this?
I would like to make a page like this (i.e. a fix segmented controller on the top, with a uitableview appending beneath it):
So, this is the way I did it: I have added a segmented controller in a uiviewcontroller, then I append a uitableview under it. Here is the diagram in the storyboard:
However, when it runs in the simulator, the header of the uitableview is abnormally tall.
I have no idea why it is like this. Am I going to a wrong direction? Thanks for any helps.
UPDATE:
This is the default setting of the uitableview. I didn't change any thing.
Select your view controller in storyboard. In the Attributes inspector, uncheck "Adjust Scroll View Insets" and uncheck "Under Top Bars".
You have placed Segment control in Tableview's header. But you had set some height to tableview section header via either xib or programmatically. That's why it leads to show this space.