cc.ScrolView undefined in cocos2d-js - cocos2d-js

I tried to use ScrollView, TableView from cocos2d-js extensions and I noticed that it can't be seen!
I also tried to create a class from that example but i need to use from native class!

In order to load extensions, you should add "extensions" in "module" section in project.json. For example:
{
...
"module": ["cocos2d", "extensions"]
}

Related

Make header file for method list for Swift file?

I have created a class (in Swift) which is a wrapper on NSURLSession. There are many methods in that. Now, in Swift we don't have header file. I need to have a file which lists all the methods of that class, for example we navigate to the UITableView.h file while we click on any default method of UITableView where we can all the available methods and properties for UITableView.
I want to do this, so any user of that class can see the list of available methods list at one place which can be used.
Any help or suggestion will be appreciated.
Developers can access this information in xcode anyway. Just select Generated interface in the Assistant Editor and it will show you the public interface for your class:
Xcode shortcut: cmd + control + up arrow key

Can't find custom controller class in custom class dropdown Xcode 8.3.2

I just started developing for iOS and WatchOS and have encountered a small issue that is probably very simple but I can't find any solution for it.
The issue I'm having is that I'm trying to structure my files in my own way but when creating new controllers, I cannot find them in the Custom Class dropdown on the Interface.storyboard
For example, I renamed InterfaceController.swift to Controllers/InitialViewController.swift to better match what I'm trying to do with my project structure.
For some reason InterfaceController still is showing up on there and if I type in the fullname of the new class, it won't show up. I'm unable to get that class here.
Any help at all would be great, thanks!
Renaming your file will not change the class name. You will have to modify the class declaration inside the file.
class InitialViewController: UIViewController {
/* code for your class */
}
Also, putting your files inside folders (blue folder icon) or Xcode groups (yellow folder icon) will not affect the class name.

How to make a file with my own functions in Swift

When I worked in Delphi, I had a special file with functions which were created by me. This file had a static way which was added to library path in Delphi settings and it could be used from anywere just by adding "lib" into "uses" block of .pas file.
Now I'm working in Swift and would like to make the same. I want to have a file which will have it's static way on PC and will be able to use itself from any ViewController just by adding "Import myLib"
How can I do it correctly?
Simple solution without an explicit static library:
Create a Swift file somewhere outside any product folder containing a class (or multiple classes) and class functions, for example
class GlobalFunctions {
class func function1()
{
println("function 1")
}
class func function2()
{
println("function 2")
}
}
In each project you need the file add the file (⌘⌥A)to the project but uncheck Copy items if needed in the dialog box.
Call a function with
GlobalFunctions.function1()
Any import statement or changing Build Settings is not needed

how to package UIViewController?

I have create a UIViewController, e.g DemoTableViewController, and want to reuse it in other project. Instead of copying source file of controller, I need to create a library to reuse it, however, after I create a static library containing DemoTableViewController, and set the class of a view controller in storyboard, there's a an error:
Unknown class DemoTableViewController in Interface Builder file.
what can I do?
In the custom class field on the right top, you can see that you have given it as DemoTableViewController instead of DemoViewController(Assuming that what you have mentioned in question as DemoViewController is the class name you have given to this custom class). Change that and then check. It should work.
If the above is not working, make sure you have copied the DemoTableViewController.h file to your current project and this library is added to target settings -> Linked frameworks and libraries.

Unknown class info in Interface Builder file

like in the title i got a crazy massage and i cannot handle with it
Unknown class info in Interface Builder file.
Every time I run my Project some crazy bugs will appear or some bars disappear. Did anyone know what to do?
Try this, in order:
Product->Clean in Xcode
Delete the app from the simulator or device
Restart Xcode
(Build &) Run again
If this doesn't help, you likely have a reference to a class in the nib or storyboard that you have to manually find and remove.
The warning may be because you have assigned a removed/deleted custom class name for one of the UIView subclass. In order to fix such scenarios,
Open interface builder class as Source Code by right clicking on it (Open As -> Source Code).
Find your unknown class name in the source file. And handle accordingly.
It worked for me.
See my answer to https://stackoverflow.com/a/29013058/784318
I did run into this problem today using Swift.
I changed a class Model.h + Model.m to a Model.swift.
This object was used in Interface Builder with the class = Model.
As soon as I replaced the object the class could no longer be loaded.
What I had to do was to change the class reference in IB from:
Class = Model
Module =
to
Class = Model
Module = <TARGETNAME>
You'll find the <TARGETNAME> in the build settings. It is also the name that shows up in your generated Swift-Header: #import "TARGETNAME-Swift.h"
I have solved this problem (while using Swift 4 / Xcode 10.1) by going to Custom Class panel, checking 'Inherit Module From Target' (right below Class & Module row).
I have got the same issue with Lottie library.
Unknown class AnimationView in Interface Builder file.
It can happens if your class view is in an other module.
To resolve this, go in your IB file (Xib or storyboard) / Show the identity inspector and set correctly the module :
I tend to see these types of errors when you change the name of your view and view controller classes after customizing a view or controller in Interface Builder to that class. I'd go through your views and controllers in your nib or storyboard to see if your custom classes still exist and match accordingly.
You'll run into issues with IB files when you rename or delete the underlying code without updating the IB file. A similar issue occurs when deleting or changing the name of IBOutlets after linking them to an object in Interface Builder. You'll still have the reference in Interface Builder unless you delete it explicitly.
Lastly, you can look at the IB file as a text file. It's an xml document, where you'll see all the class references. You can see if there are any classes there that may not exist in your project anymore.
This also happens if you deleted ClassName.m from Build Phases/Compile Sources
I'll restate the problem, with a bit of context from my end, then provide the solution:
I have created a custom Swift framework, and imported the framework project into the workspace. Then, I made the framework a target dependency to my Swift application. Finally, I referenced a class from the framework in Interface builder.
I kept getting the class not found error, and I noticed in the debugger it had the output class was the mangled/unmangled ObjC counterpart ..
The solution:
Simply add your framework header to your ObjC bridging header:
#import <MazKit/MazKit-Swift.h> // In my case, MazKit
Now, the symbols are exported, and you can verify that by cmd + click on the header itself, and you'll see the mangled/unmangled class names.
Project -> General -> Deployment Info -> Main Interface <- clear this field.
It seems you have deleted file Main (Storyboard) but you still have reference to it in project properties.
It could be that the file was not copied over in the build process. Goto the Build Phases Tab and check the copy Bundle resources to see if the file is there. If not add to the project clean and rebuild to see if that fixes your issue. This has helps me.
I had renamed one of my TableViewCell Class. Nothing worked other than checking the Inherit Module From Target checkbox.
Open the xib file > Goto Identity Inspector while it is selected > Check the checkbox (also make sure the Class name is correct).
Done!

Resources