XCode 8.2.1 Unwind Segue Tableview weird bug - iphone

i am programming my App right now and i am using a Navigation Controller inside a TabBarController.
Now i have added 2 unwind segues and the first one works perfect, but the second one creates a weird bug. When i load the tableView for the first time it looks everything okay like this:
Everything looks good
And after I return from the childView it looks like this:
TableView bugs
If you touch anywhere the cell just disappears and you can only see a blank view
I appreciate any help. Thanks !
EDIT
It seems that the error is triggered by the unwind function. Without the segue it does not show the error

Related

Unwind segue results in black screen? UITabBarController with embedded VCs and segues

I have the following hierarchy for my app:
UITabBarController, first tab is a BrowseVC (another UIViewController). BrowseVC has a SegmentedControl, each of which will show a version of the PersonVC (another VC with a UICollectionView in the ContentView). They are each loaded with a lazy instantiation like this article. Tapping a cell in the PersonVC will show PersonDetailsVC via a modal segue.
I'm attempting to put a "Back" button on the PersonDetailsVC to get back to the PeopleVC collection view. I thought I'd have to put the unwind segue in the UITabBarController, however, while it is called just fine (a print statement shows it "works"), the view is black.
Using the Xcode view debugger, the PeopleVC is in the hierarchy on the left, but I've no idea where it is physically.
For this configuration, which VC should the unwind be located in? I've tried putting in the BrowseVC and the PeopleVC but it would seem logical that the TabBarController would need to reload all of the content? Is there a best practice for this scenario? I can't imagine this is very unique at all. What gotcha(s) might I be missing?
TIA!
Apparently it is the modal presentation that is killing the unwind capability. Other presentation methods work fine. Disappointing.

Button with #IBAction in a segue viewcontroller?

I am starting to learn iPhone development and I like the way to start with segues and different storyboard. That makes starting to develop pretty easy, but I encountered the following problem and I am not sure if this is just an XCode hiccup or if I'm doing something wrong.
The idea is the following:
Main ViewController > sequel to another ViewController > segue to another ViewController
Everything is done with simple buttons which just trigger a segue visually placed new ViewController in XCode.
On the third Controller is a button and for some reason it is not possible to create an #IBAction. Every time I try to use CTRL + Drag it's not possible to create an Outlet. But when I place a button on the first ViewController, CTRL + Drag works like magic and I can create an #IBAction.
Am I doing something wrong, missing something or is this not working when being on the third or fourth ViewController in a segue sequence?
Thanks for helping in advance.

Segue moving too quickly while passing data?

I am making an app where the user inputs some numbers into a text field and it shoots out an answer on a label. I have the answer being displayed on another view controller. Using the same prepare for segue methods on all of the screens that I have only some of them work. The others will pass whatever text I have in the first view controller label (I have checked this by inputting all sorts of stuff and it shows up on the other side)... I have also deleted the segue and made sure that the calculation works and the label in the first view controller is getting the information.
This leads me to believe that the way it is set up is fine, but the segue happens so fast that the label on the first view controller will still have the original text when the segue is performed, sending that information over as a string instead of the answer...
Is it possible to change this? It would be the only logical thing that makes sense to me write at the moment. If it is possible how could this be fixed?
Any help would be appreciated. Thanks
EDIT:
This is the whole code I was Asked To post to help figure this out
So if in the first view controller I put a '?' for the text in the label just to hold the label, and in the second view controller I put a '!' in the answer label to hold the label.. The second view controller after I run the simulator the second view controller will show a ? the text from the 1st label... so it does show that it is pushing the data over, it is just not pushing the information in the label.
I think you have a made a segue to another view controller from the same button , with which you are performing the #IBAction func usednroicalc(sender: AnyObject), what you have to do is make a segue from view controller to another view controller in storyboard , give your segue an identifier and inside the #IBAction write at the place where you want to perform the segue , that is after your calculations write , self.performseguewithIdentifier("your identifier") . you can give identifier to segue by clicking on it and than find the identifier label in the inspector.
EDIT:
Here I have dragged from ViewController the one Highlighted as yellow in ViewController Scene to TableViewController the one above first responder in TableView Controller Scene.
Just wanted to answer my own question as I have found a way to push the info over finally...
You have to set up the calculations of the code in the prepare for segue and not in the button action. The button action is now only setup for the segue to the new view controller. not the way I wanted everything thing to go but it works.
Thanks everyone for the feedback... hope this helps someone else in the future.

NIB File Doesn't Display at Runtime

I am pulling my hair out on this one. I have a NavigationController with two levels of TableViews. Each TableView is in its own NIB file. The first level simply displays a list. Upon selecting a cell, it takes the user to a second level TableView with a more detailed list. It is on this second level TableView that I want to display a search bar (actually I am using a SearchDisplayController as well). I have added it to the TableView because I want the SearchBar to scroll with the table.
Below, I am displaying two screenshots. The first is the second level tableview in InterfaceBuidler. The second is the second level tableview at runtime. For some reason, the SearchBar doesn't display at runtime.
I have tried creating a completely new project from scratch and the same things happens. I don't understand why the SearchBar doesn't display on a NIB pushed on the NavigationController.
Before you ask, if I put the SearchBar on the first level TableView, it shows up just fine. Yes, I am adding it to the TableView itself, so it is a part of the view that should be displayed.
Help! What am I doing wrong?
This is what actually displays after the XIB is pushed...
Okay, I'm going to have to answer my own question. I thought about deleting it, but perhaps this could help someone else. I really pulled my hair out on this one. It wasn't because of anything I was doing wrong so much as a fundamental misunderstanding of how iPhone development works.
In a nutshell, the problem was with this line of code, which instantiated the TableViewController:
self.downloadDetailViewController = [[DownloadDetailTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
When you use XCode to create a new class, you can use the following:
"Add -> New File -> Cocoa Touch Class -> UIViewController subclass -> UITableViewController
subclass AND With XIB for user interface"
The problem is that the NIB has absolutely nothing to do with the UITableViewController until you tell your code to use it. To me, this seems like a bug in XCode or at the very least something that is counterintuitive. When the development environment creates all three files together, it would only make sense that they would work together, but they don't.
Instead, the solution is to modify the line of code as follows:
self.downloadDetailViewController = [[DownloadDetailTableViewController alloc] initWithNibName:#"SecondaryView" bundle:[NSBundle mainBundle]];
Hopefully this can help someone else...
You could also set Nib Name property on your Download View Controller under the Tab Bar Controller, in fact that and coupled with setting the class with your class name will automatically create the view for you and you don't have to manually create it.
I think the problem is that you are adding the searchbar to the tableView, so it is not displaying.
Try to add that searchBar with out adding to the table view, that means move the table view some what down and add the search bar to the view(not the tableview).

Only showing View after second Push on iPhone

I'm having an annoying problem, that may have a simple answer!
I have a ViewController (which contains a TableView Controller and Header View) which I am pushing on to a Navigation Controller - When I push it on the first time after launching, I get a blank view. When I click the Back button to pop it, it appears fine from then on until I re-launch the app.
Does anyone know an "obvious" reason why this would happen?
BTW- following the code in Debug, it appears to be doing all the correct things.. loading the ViewController variables if nil, etc. before the first view.
Thanks!
did you reload the table after data are loaded ?
[tableView reloadData];