Extra space above prototype cell. Swift 3 - swift

If you look at the screenshot below of my table view theres a big gap between the prototype cell and the top of the table. Ive tried to re-size it but it just resizes the whole thing. Does anyone know how to make the prototype cell closer to the top of the table view?

This seems to be some sort of a bug, but it is easily solved. Drag a UIView from the object library and add it above the TableView as I've done in the image below. The problem should resolve itself.

Related

Search bar displaying beneath table - swift storyboard

Seems like a pretty basic issue, but I have a tableViewController and at the top of the screen I've got a collection, beneath this I want to include a Search Bar. But for some reason it won't let me place this above the Table View Cell. It will let me add it into the collection view bizarrely but it goes behind the cells.
Is this a limitation caused by the fact I've included a Collection at the top of the screen? Is there only space for one element above a table on a tableViewController? Is there a workaround whilst still using a tableViewController?
Likely a noob question, but I'm still v noob
Is there only space for one element above a table on a
tableViewController?
Correct.
You get one header view area, and one footer view area for the tableViewController as a whole. (plus extras for the sections)
If you want a quick solution for a simple table then the tableViewController saves you about 60 seconds. - but if you want to do something more complex now or later, then you may want to consider using a regular UIViewController, dropping a UITableView into it and applying constraints as needed.
You would also need to remember to set the tableView dataSource and delegate up and comply to their protocols - or you go the diffableDataSource route.
Thanks #agentoverflow I couldn't find any documentation that explained the limitations of a UITableViewController.
Came up with my own solution. Put a view into the header area and put my collectionView and searchBar into that. Hooked the code up for both elements and both are working as expected.

how to create a sectioned TableView for profile in iPhone

I saw this picture on Internet:
the section with the add Photo Frame and two rows (First, Last)...
How do you achieve a design like that!!!
I only know how to make rows (static and dynamic) in xCode using the full width of the screen but not in a single section but not making such a divisiĆ³n and adding a frame out of the other two rows
my designs are like this
Any help I'll appreciate
thanks in advance
It's not really clear that the example you've given is actually embedding the first, last part into a table view. It could just as easily be a single cell that has embedded views with borders to look like rows. Here are a few ways I see to accomplish the view you've given.
Have them be actual rows - but use a custom cell layout that offsets the 'First' and 'Last' labels to be further to the right. Then create a UIImageView for the profile that sits on top of the UITableView cells, but inside of it. Basically insert it as the first subview of the UITableView. It should cover the top left of those top two cells. You can do this since those cells have a static known hight and you've set the left offset. Another option would be just inserting it into your top cell, but having it overflow the bounds and setting clipsToBounds = NO.
Make the entire top view a custom UIView that uses CALayers or CoreGraphics to manually draw the lines and layout such that it looks like part of the table view. Set that as the TableView header, or the first section Header.
There are a lot more things you can do like changing frame layout as well.
you can achieve this with the use of xib read carefully and if you don't understand anything you can ask me again it's bit tricky
in you xib create a UIView and design for your photo and firstname, lastname cells with the use of textfields image views and all and then take a UITableView.
now drag your UIView and drop it on your UITableView so that it will be considered as your table header and your first section now will be as you designed like photo with firstname and lastname fields.
i've done this in manier projects of mine so hope this way you can also do this thing and ask me if you need any help.

UIImageView and UItextView inside TableView

I'm working on iOS RSS app, and my last view, which is a UIViewController, is similar to the attached image. I inserted in my DetailView.xib, one Image View to pass the images of the RSS feeds and two Text View to pass the title and summary respectively.
The question is, how can i make the same, but inside a UITableview?
you can use custom cells for it and can add this custom cell at particular index. At first index you just add image view and at second index you just add textview.
Check out this pretty good tutorial Custom UITableViewCell Using Interface Builder.
i hope it helps you.
You can achieve this particular thing by using Custom Table View Cell.
Table View gets created using single Table View Cell again and again. It is much more efficient and uses less memory.
You should check this tutorial.
I hope it will help you.
Thanks
You can make TableView height UITableView.automaticDimension and make sure UITextView autoscroll is disabled and constraint should be leading, trailing, bottom and top.
Here's the link this might work for you:
How to make a UITextView Expand with the text like the Notes app

Labels and images above TableView don't show up on device

So, I've laid out a UITableViewController with two prototype cells, and a view in the TableView's header area. In the header area, there are two views that each hold an icon and a label, Friends and Groups.
It looks all good in the Storyboard Editor, but when the screen actually loads, the images and labels in question are gone. I'm fairly new to iOS, so I haven't run into this before. Here are a couple screen shots to illustrate:
In the storyboard editor:
On the simulator:
Any thoughts? Thanks in advance for your help.
You've implemented the data source methods in your view controller, correct?
If not, UITableView will call a method that its data source implements: tableView:cellForRowAtIndexPath: from the UITableViewDataSource protocol, where you would return the cell to use, in this case the cell with the Identifier that you specified in your Storyboard.
We figured out that this was because the tableHeaderView of a UITableView is really weird about updating/redrawing. It's very difficult to get it to act in any sort of expected behavior.
Instead of using UIImageViews, we used UIButtons. The buttons seem to know how and when to updated and redraw themselves, so that worked.

Broken cell with an odd strikethrough?

I'm having a weird issue with a particular UITableView in my iPhone devel experience here. If you look at the following screenshot:
alt text http://dl-client.getdropbox.com/u/57676/brokencell.png
you'll notice a strike through going through the middle of the 'Jane Aba' cell.
Any idea what might be causing this odd graphic display? It's true for both the simulator and for the actual device running 2.2 SDK.
As requested, here's my -tableView:cellForRowIndexPath: method:
* EDIT *
I've located the problem. I'm not entirely sure why this is the problem, but it is. In my RootViewController, I have the following line of code in my -initWithCoder: method:
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
When I comment that out, the cell (which is not in the RootViewController, but a secondary controller) it's resolved. Any idea why this might be the case?
I've had a similar problem. For me, the single line was caused by a superfluous view that was created but never sized or placed correctly and so was 1 pixel high, floating over everything else. You can also cause this by confusing a UINavigationController about its set of subviews (by adding views directly to its layout container).
Look through your UI (xib files and programmatically created views) for a view that shouldn't be there or is otherwise not being used. It might be helpful to write some code to dump a UI Hierarchy, so you can see what views are where.
Are you doing anything special in your -tableView:heightForRowAtIndexPath: method?
It looks to me like the height of the row is being set incorrectly, so the contents of the cell are expanding outside of its bounds.
The problem disappears when you set the cell height for the table view to 1 pixel in IB. It seems that before you populate the table, an empty table is drawn with the outlines of the cell height set in IB.
Don't set the cell height to 0. IB doesn't like that. :-)