I created a class called HelloWorld and I would like to link it with a display.
I could code in the HelloWorld class in order to control the behaviour for a specific app page.
However, when I clicked on the identifier inspector, it doesn't show the HelloWorld class at all. I was wondering which process I did it incorrectly?
Here is an example:
While creating a class always remember to choose correct class for your subclass. like if you are trying to add class in UITableViewController type view than your subclass must be of UITableViewController
I guess the problem is you are trying to change you ViewController's view's class, not your controller's class.
To do that,
Step 1: click on your view controller/Click on Hello World shown in your above image.
Step 2: Then try to change class name in interface builder.
That's it.
Related
When I change my ViewController class name after it's been created and assigned to a view controller in storyboards I run into problems with the IBOutlets of that view controller, and Xcode does not automatically show the corresponding class in the assistant editor when I click the scene.
I've changed the name of the actual file, the class declaration within the file, and the class of the view controller in storyboards. Am I missing something else?
A)
If you're using Xcode 9 or later, just select the class name, right click -> Refactor -> Rename
Ex.: class MapViewController: UIViewController - just select the "MapViewController", then right click -> Refactor -> Rename
This will change the name file name, class name and take care of the storyboard class name.
B)
If you can't use the method A, then manually rename the class name, file name (.swift), then go to the storyboard and replace the class name of the view controller.
You may have issues with the outlets. In this case try to close Xcode and re-launch then remove all IBOutlets and reconnect them again.
Click on the controller name that you want to change.
Inside the class right-click on the class name of the controller.
Now you'll be able to see REFACTOR option.
Click on the refactor you can get RENAME option.
Give whatever name that you want, then click on RENAME.
Maybe I'm just going about this the wrong way, but I'm trying to figure out how to add a VIMVideoPlayerView to my view controller through storyboard.
The documentation says "Create a new VIMVideoPlayerView instance or set up an #IBOutlet:" which as far as I understand means that I should be able to add it through the interface builder. But this object does not appear in the object library.
I'm pretty new to this, so I'm trying to figure out how to add a submodule object into my storyboard. I added VIMVideoPlayer using CocoaPods.
If this actually isn't possible, what is the proper way to setup a VIMVideoPlayer programically?
Drag a view from object list and change set it class to VIMVideoPlayerView. Then you will be able to create IBOutlet for this Enter VIMVideo class name under class
I have not worked with Vimeo library but you need to drag and drop a UIView on the storyboard and set the class of this UIView to VIMVideoPlayerView
I have integrated EDStarRating in my application. it is working fine on one viewcontroller. but strange problem is it is not working on another view controller.
I have searched almost all google quection releted to this problem but nothing is working for me.
I have deleted EDStarRating from my application added again. then also it is not showing in custom class drop down list. I have checked in build phases, it is there.
Another strange thing is it is not showing in custom class drop down but it is working fine on one view controller there is no issue.
same thing trying to apply on another view controller it is giving error.
Unknown class _MyApplication14MYEDStarRating in Interface Builder file.
Appreciate for help
Are you writing both the view controller that it works on and the one it doesn't in Swift? That you're getting a module-mangled class name for an Objective-C class suggests that you're running into a form of this bug:
Objective-C class is interpreted as Swift class in Interface Builder
Actual Results:
Outlet will refer to a Swift class - Name is mangled with App module name, so it can't resolve to an instance of that class.
The result is the subview having the original class in interface builder. If it was dragged from a 'View', it will be an instance of UIView, if it was dragged from 'ImageView', it will be an instance of UIImageView.
What I'd suggest is taking a look at the source of your storyboard (right click, Open As > Source Code) and manually copying the customClass from the instance that works to the instance that doesn't. Assuming they are different, and Interface Builder just got confused. If they're not different ... then there's some more subtle Swift/Objective-C bridging problem. Probably just rewriting EDStarRating in Swift would be quicker than figuring it out, really.
Let me preface this by saying that I've already tried quitting and restarting Xcode, as well as deleting derived data for the project, to no avail. I'm at wits end right now.
Basically, I've created a custom ViewController class I want to use, but I cannot select it. In fact, using the Custom Class dropdown, I can only select the default UITableViewController class for my controller. The weird part is, it looks like the full list appears for a split second sometimes, before being replaced by the incorrect list with a single option. Here's what it looks like:
I would really appreciate any ideas here. I'm not really sure what I could have done wrong, since I was following this Apple tutorial pretty much to the T.
For another scene in my project, which is just a plain view controller, I can select custom classes with no problems.
Ideas?
You have to inherit from UITableViewController class so basically the interface file (.h) should looks like that:
#interface YOURCLASSNAME : UITableViewController
Make sure you replace YOURCLASSNAME with your class name and you add UITableViewController and that should do the job.
Make sure the swift file is defined as a UITableViewController and not as a UIViewController.
This should be easy - but I am scratching my head over it. Here's the problem:
I have a custom class that I import into my MainViewController.h file. The class contains a bunch of properties and a few methods.
I instantiate an object of this class in the ViewDidLoad section, and can run any of the methods or alter the properties on this object at will... they work fine as long as I stay within the ViewDidLoad section.
I created a button with which I wish to activate one of my custom class methods on this object, but the IBAction section seems out of scope, as it doesn't see the object created in ViewDidLoad at all.
Can someone point me in the right direction to enable these two areas to see eachother?
Thanks in advance!