Delete View References from View Controllers Swift iOS app - ios

How to automatically remove all references in an iOS Swift app(developed using XCode) from ViewControllers when deleting the View in a storyboard?

I think there's not an automatic way to remove the reference within your code. Anyway, you can use the Connections inspector to see all the outlets and actions referring to your view and you can unlink them before actually removing the view from the storyboard. The rest is kind of code maintenance that I usually do by hand.

Related

Cant control drag a reference object to the ViewController in Xcode 9.2 (9C40b) iOS project

How to a create an outlet for an iOS control on the storyboard that is connected to my swift ViewController code?
All the tutorials for iOS development show that you can control drag a UI element to your ViewContoller swift code for an outlet. However it never works for me, it shows the blue line from the storyboard, but on the drop it never brings up the dialog to add a new outlet.
Creating a new Action drag and drop works just fine for buttons. I have seen many ask this question and there seems to be no definite answer.
Is there something different with iOS projects?
I tried to set the View Controller custom class to my specific ViewController class, and then I can drag and drop a new outlet. However the project fails to compile.
LaunchScreen.storyboard: error: Illegal Configuration: Launch screens may not set custom classnames
I seem to be missing something here, but all the tutorials I watch/read (none seem to cover Xcode 9 or swift 4) all show this behavior as being the normal way to create an outlet.
Launch screens are not able to have outlets attached to them. They are static. If you'd like to have a "launch screen" that you can manipulate, duplicate your launch screen layout into an initial view controller and do what you like there.
I think this is because you are connecting it from the LaunchScreen.xib instead of the main.storyboard files.

How do I remove all reference outlets from a view at once?

I'm relatively new to iOS development and I'm looking for ways to speed up when programming at XCode.
I know it's possible to remove an outlet by right clicking to a view in the storyboard and then click the little x by the referencing outlet.
Is there a keyboard shortcut or another way to remove all outlet references from a view at once?
This would be very useful when copying and pasting views.
By clicking on View Controller it will show on the right side all connected interface outlets, and it's easier to remove one by one there. This is not what you looking for, but at least will help to remove outlet references a bit faster.

Will we get frequent conflicts when using storyboard?

I think using storyboard will save us a lot of work sometimes. But when more than one mates working on the same storyboard. Is it possible that conflicts occurs frequently? When using .xib I and my workmates will have conflicts when we are working on the same .xib. So how about the storyboard? BTW:Don't tell me to use more than one storyboard. I think I prefer xib than storyboard if I need to use more than one storyboard.
If you have one big storyboard for your app, and several developers on your team will need to make changes in the storyboard, you will probably get conflicts.
If you're using xibs, you can put unrelated views in separate xibs. Then when developer A needs to change something in view 1, he just changes the xib containing view 1. And at the same time, if developer B changes something in view 2, he changes the xib containing view 2, which is probably separate from the xib containing view 1. So you don't get a conflict.
If you're using a storyboard, all the views are in one file. So developer A changes the storyboard to modify view 1, and at the same time developer B changes the storyboard to modify view 2. Boom, you get a conflict.
If your team has multiple developers working on the app user interface, you are much more likely to get conflicts if you use storyboards than if you use (carefully-separated) xibs. This is a serious problem with storyboards.
However, you can't create a table view controller with static content in a xib. You can only do that in a storyboard. So sometimes it's worthwhile to create a storyboard containing just one table view controller, in a project that uses xibs for everything else.

Do I need multiple view controllers for the iPhone & iPad storyboards?

I'm still relatively unfamiliar with all the new features of iOS 5, and what I can do in Xcode now. So, a good explanation would be appreciated.
I'm designed a single-view application and I have both an iPhone and iPad storyboard. I chose 'Single View Application' when I first started, so Xcode created a ViewController for me. Both storyboards list this view controller as their own.
Back in iOS 4 the way that I linked button actions to my view controller was to Right-Click on the button on the nib, pick the action that I wanted, then drag it over into the view controller's '.h' file, which auto-created a method/property for me.
I am confused about how to accomplish this now, since I have multiple storyboards but only one view controller. Do I need to have multiple links for each button; one for the button on the iPhone and one for the iPad? Or is there a better way to accomplish what I am trying to do now?
You do it the same way you did it in iOS4. But obviously you never built an universal app there ;-)
It's totally okay to have a single UIViewController class for two different nib files.
And if you use storyboards it's fine to use different storyboards and a single viewController too.
You can even use the same viewController for different scenes inside a single storyboard.
The connections to the viewController are saved in the nib or storyboard. So you can't overwrite them while designing the other user interface.
Open the iPhone storyboard, make your connections to actions and outlets. Then open the iPad storyboard and make totally independent connections.
In response to the first reply, I was under the impression that a view controller could only support two scenes in a storyboard layout. I say that because I found this thread.

Using Storyboard how to interact with viewcontroller objects

I've reviewed many websites and youtube videos that have IOS 5 storyboarding information. Most of them are pretty basic and only describe how to get started with storyboarding and how to segue into other views. I'm interested in taking it a step further and actually adding custom code to the views contained within the storyboard.
Is the "normal" workflow when creating an IOS app using storyboard?
Create the layout of an app using storyboard (adding views and objects to those views).
Create viewcontroller files (.h and .m), one for each view contained within the storyboard.
Hook up the scenes from the storyboard with your own view controller subclasses by editing the "class" values in Identity Inspector.
I believe I followed those steps, but when I implemented step #3 above and ran my application, I was only able to see a black screen. The view I had created in storyboard wouldn't display.
You have the right steps. Make sure you create your .m and .h without a xib. Post your code for the view controller for your first view to get more help.
yes, this is the normal workflow. have you set the "initial viewcontroller? ?
see this image: http://dl.dropbox.com/u/31437518/Screen%20Shot%202012-01-24%20at%2012.29.34%20AM.png
It sounds like you made a storyboard file but it isn't being loaded.
Do you have the main storyboard setting in the target summary screen filled in?

Resources