How to update viewcontroller - ios

I’ve put code in ViewWillAppear and I’ve tried ViewDidAppear but the app only updates when I close it and re-open it. Anyone have any idea on how to fix this? I’m using UserDefaults to update the app with. I’m new to swift and I’m using storyboard so could it have something to do with the hierarchy ? Any help on this would be really appreciated.
I am creating an app with a spinning wheel which updates with options put in a table view, ive added some pictures to help illustrate.
The table view updates fine but when I go back to the main screen nothing happens until I close the app and re-open it
I link my github in case you want to look at full code base.
https://github.com/jamesnjones/Just.Decide
ImageOfTable
ImageOfWheel

solved by including
spinningWheel.setNeedsDisplay()
spinningWheel.setNeedsLayout()
in view will appear

Related

iOS Storyboard ViewController went Blank

I'm working on the code in a project when I suddenly notice the ViewController in Storyboards is greyed out with the name of the VC in the center.
Here's a screenshot..
I was only editing some code on the right and I'm not sure exactly when, but my eyes adjusted and noticed this VC completely greyed out in Storyboards.
I tried deleting Derived Data, cleaning, quitting Xcode, building again, etc.
Nothing seems to work... ANy help with this would be super appreciated. I'm also very new to programming in general.
Well it turns out if you ever run into this problem, it's because you're not paying close attention and haven't realized you've somehow magically deleted your entire view inside the ViewController.
I did this once before by hitting something randomly on my keyboard (don't know what it was) but that time I saw it happen and just hit "undo".
This time I was passed the point of simply hitting "undo" and had to add a view again and rebuild and reconnect all the components in the view. That was basically it. Problem solved...

Having issues with auto layout showing up different than preview

I'm trying to follow the tutorial on Apples Swift Tutorial
I've followed the UI layout but for some reason, when I hit play and the simulator pops up, my simulator shows up different than my preview. Any suggestions?
I feel this question may help somebody in the future so I won't bother deleting it.
Through my own stupidity I ended up building the UI under the LaunchScreen.storyboard ViewController instead of the Main.storyboard ViewController. Simple fix -> Put things where it belongs!

NavigationBarButton Not Showing

Is it common issue when connecting tabBarController using storyboard?.instantiateViewController(withIdentifier:), the navigationBarButtons don't show ? And is there a proper way to fix this particular issue ? Because when I connect the views using segue, the buttons show just fine on navigationBar ..
Please help.
It's a big project, I couldn't take a picture of the whole project but this is a small part of it.

Segue back button disappeared in iOS 9

Before iOS 9 was released, I've developed an app targeting iOS 8.4. I've used some UITableView connected each other via segue of kind "Show (e.g. Push)". It worked perfectly with the right behavior: every time I switched from a UITableView to another, the back button appeared, so the user is able to turn back to the previous scene; the back button appeared also from UITableView to UIViewController, using the same kind of segue. Now I have upgraded to the latest version of Xcode and targeting the app to iOS 9.0, I got this problem: now, if I go from UITableView to another UITableView, the back button doesn't appear anymore, but if I go from UITableView to UIViewController, the back button appears. I've seen other developers has had a similar problem (as you can see here, here and here), but I don't understand how they have solved (except for the third link, but it's not my case). Anyone knows how can I get back button working again? Thanks in advance
It looks like the guy who posted the second link is having the same problem as you. In a comment he said that the way he fixed it was getting rid of the extra navigation controllers:
No need put the navigation controller for each view. put the navigation controller start view only.
So that is what I would suggest doing. Only put a navigation controller on the first view controller. Get rid of all the others.
So, thanks to Caleb's and ogres' suggestions, I solved my problem in this way as you can see in this screenshot, I hope it helps anyone who will have the same problem!
If you have two UITableViews and you want connect them to each other, you just need one NavigationController.

Done Button not working in FlipsideViewCOntroller

I'm updating my app form xib files to a storyboard. I'm also upgrading the app to iOS 7.
I have a two page app, like a Utility app. I can create e segue to flip to the second page. However when hitting the done button nothing happens. I've tried several things (the suggestions on SO too) but without result.
Ik started a new project (Utility) an compared the code for the segue and for dismissing the FlipsideViewController. In my project and the new one the code is the same.
I placed an NSLog call in the flipsideViewControllerDidFinish method but no effect.
I am out of ideas, please help.
While posting I got a (last) Idea. I had to check if the segue identifier was correct.
And it wasn't. So I corrected it and it works like a charm.
Thank you.

Resources