UITableView Partially Blank in Storyboard - ios

When trying to view a larger UITableView inside of a UIViewController in the storyboard, I can only see/edit the top most cells from the table. The moment I scroll further down the cells are all blank. This is purely for storyboard, the code works fine when running, but any cells in the storyboard that are further down a tableview I can no longer edit since they show as blank.
Here's an example to illustrate
As can be seen from the shift right click, I can't even select the cells that are there.
I know and have experienced problems such as not being able to scroll at all before, such as this, but this is different as I can scroll down but cannot see the rest of the cells of my tableview. Has anyone else ran into this problem, and would know a solution? It seems like it may have something to do with Xcode 7, as I recently upgraded to it.

Although not ideal, I've found a few work arounds for this problem. One solution is to make a temporary UIViewController with a UITableView, and then drag cells into the temp UIViewController until the cell you want to edit is visible. Once you've changed it, drag all the cells in the temporary view controller back into their correct controller. This is extremely hacky, but so far is the only way I've found to visibly see the cell.
Another thing that can be done is that the cells are still editable in the document outline, meaning constraints and elements can still be modified from there. However, it is difficult, as I wasn't able to see the cells being edited, they still appear to be blank.
Hopefully someone else finds/knows of a solution to this and can post it, I'll leave these two workarounds up though they're far from ideal.

Related

Swift: dropdown overflow disappears when scrolling down

I am working on this project where I am using drop down menus in tableView cells. I am using the following code to make the drop down part overflow the tableView cells bottoms
cell.clipsToBounds=false
cell.contentView.clipsToBounds=false
Everything works fine, but when I scroll down the tableView till the drop down part is not visible anymore, the overflow stops working. You can see the problem in action in the project below
https://github.com/Rawchris/Drop-down-overflow2
In the project I have put drop down buttons in every cell, but it is fine if it is just the first one that is working. I hope you are able to help. Please tell me if you need anymore information.
The problem is not that "overflow stops working" ... the problem is that table view cells are not drawn in order.
Taking the answer from your other question: https://stackoverflow.com/a/61252794/6257435
I shortened the cell heights to make it easier to see.
In this image:
I scrolled up and down a few times before tapping the "Row 8" button. As you can see, your gray "drop down" menu is hidden behind rows 9 and 10.
Using Debug View Hierarchy you can see exactly what's going on:
You could get around this by using a closure or delegate protocol to tell your tableViewController to bring that cell to the front when the menu is opened, but... you may still run into issues when scrolling while a "drop down" is showing. You'll also hit problems when the "drop down" is showing for multiple rows at the same time.
In general, it's not a good idea to draw outside the bounds of other views. Many issues can arise. Also - of course, this may be considered just personal opinion - the whole "drop down selection list" feels very out-of-place on a phone or tablet. It makes for a rather clunky / awkward user experience. If I were you, I'd re-think my approach.

UITableViewCell's contents disappear when app run in simulator

UITableViewCell shows up in Main.storyboard but doesn't show up in simulator.
I'm using Main.storyboard. In my simple experiment with Swift, I added a TableView, then put a UITableViewCell in it, and then I put an image and a label under the cell's content. It looks okay in Main.storyboard but when I run the project, the content disappear. All I did is purely on Main.storyboard and not touching the .swift file yet.
Here are the links of screenshots of my simple work:
How my app looks in Main.storyboard
How it looks when I run Xcode simulator on iPhone 8, the tableview cell's content disappear
I have searched the problem through the stackoverflow and found a related question here: 'UIImageView doesn't show up in simulator', then I followed the recommended solutions from the forum but still didn't solve the bug.
What I have done so far to solve the bug:
Check if every item in my view has four constraints defining X, Y position, width and height.
Try to check and uncheck the autolayout flag for my Main.storyboard
Make sure my tableview cell's contents (and everything inside my view) has alpha set to 1
Well I haven't check how things looks in my .xib file.
I would like to know if this is a bug, or just a problem in my settings?
I'm quite new to Xcode, swift, and iOS app. Any help or suggestion would be greatly appreciated. If you have the same problem with me, I would like to know your case as well.
The only reason your cell doesn't show up in the simulator is because your tableview is dynamic.
Dynamic table views have data that is loaded at runtime, where there isn't a fixed number of cells, and every cell has the same layout. The Apple tutorial is a good place to start. It guides you through on how to use a tableview/tableviewcontroller.
There is no way around it: You have to code in .swift files if you want to use dynamic table views.
If you are going to use static table views, on the other hand, the number of cells is fixed, and the data is not loaded at runtime. You can use static tableviews if you don't want anything to do with code at the moment.
I had a similar problem. I solved it by deleting constraints for the affected view and starting all over.

Weird UIStoryBoard Behavior

I am trying to put a UIImageview on top, and two UITextFields follow underneath it. All are confined with Constraints, and it was working fine a few hours ago. But Something weird is happening now. I run the app, and the View comes around but there is no ImageView or where the UITextFields were supposed to be, they aren't visible there anymore, but when i click on that position, the Keyboard pops out, which means there are both UITextFields here but somehow can't be seen. I've cleaned, deleted derived data etc but nothing is coming around. Any idea?
So here are two snapshots that explains that the image "launchSplash" is coming over the other elements. How could I make it go back?
Thank you everyone for helping me out here, it was a mere change or hierarchy of in my Storyboard UI. I didn't put them in the order required and was experiencing this bug. Here are attached snapshots of the new working order of elements in my View Controller.
Thanks again for all your help, Inspecting sure is helpful and fun :)

Custom UITableViewCell class in Xcode 4.2

I've been following this Apple Doc to add a custom UITableViewCell that I layed out in an .xib to my project. One problem with the doc is that it seems like it was written for an older version of Xcode.
I'm able to load my UITableViewController that the custom cells are on, but the cells are all blank. My custom cell contains several UILabels, and has a non-default background color. The table that appears when I run has the default white background and no labels. If I change the UITableView's View -> Background on my storyboard, the color of the cells' background changes, but the labels still don't appear.
Of interest is the fact that the data is still in my table's cells. The UITableViewController is itself called as a popover from another controller. When I select one of the cells, the strings from the various label.texts are supposed to be loaded into their own labels on the popover's delegate, and that code works fine (except when I try to include a UINavigationBar in my popover, but that's probably another issue entirely).
I'm still pretty new to iOS developement, so if there's anything I'm leaving out or being unclear about let me know.
Edit - cleaned up code, now is completely different question than when I originally posted, but is still on the same topic. Should I have deleted the old question and posted this as a new question all together, or is it alright that I just edited it?
I'm still not entirely sure what was wrong with what I was doing before, but I managed to get what I wanted. I originally dropped a UITableViewController onto my storyboard set up a popover segue (also on the storyboard) and tried to display the popover with performSegueWithIdentifier. Instead, I now create the popover completely in my code (which I found a nice tutorial for here on SO, by goggling "show popover programmaticly"), without having anything for it on my storyboard. That seems to be the most documented and stable way to show a popover. Once I displayed it that way, my custom cells showed up exactly like I wanted.

TableView doesn't allow scrolling if it contains only a few rows

In my navigation controller, I have a TableView with a searchbar at the top. I want this searchbar hidden unless the user drags the table down (as in how it works in the Music app). But if my table has only a few rows (not enough to cause content to go offscreen), the table isn't initially scrollable. If I select a row (causing the navigation controller to load a new view) and then go back to the original view, the table is now scrollable and I can drag down the table to expose to searchbar.
I have no idea what's causing this. I don't know if it's an Apple bug or if I've done something stupid in my code. Has anyone seen this before?
So I think it's a bug in iOS. After a lot of mucking around with my code, and Googling, I found someone else with the same problem:
UITableView Won't Scroll In Certain Conditions
They put forward a solution that has worked for me.

Resources