I cant find createPaintView() function in .m files of ti.paint module. where is it ?

Hello people,
I had gone through all .m files of ti.paint module but didn't find createPaintView() function in these (you can see
here). where to define such methods in our own module ?

when i tried with mine, the error I got was this

[ERROR] Script Error = -[UIView boundBridge:withKrollObject:]: unrecognized selector sent to instance 0xa026280 at moduletest.js (line 10)

the code in .m (other than assets.m)file is(in #pragma Public APIs region)#

#pragma Public APIs
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0,0,320,460)];
    [view setBackgroundColor:[UIColor redColor]];
    return view;

    // example method
    return @"hello world";

code in moduletest.js is

var window = Ti.UI.currentWindow;
var label = Ti.UI.createLabel();

// TODO: write your module tests here
var moduletest = require('ti.moduletest');
Ti.API.info("module is => " + moduletest);

var view = moduletest.createView();

Thank You in advance.

— asked 4 years ago by nitin soni
  • The error is here

    var view = moduletest.createView();

    — commented 4 years ago by nitin soni
  • Question is not closed I still have problem.

    Now i created a class subclass of NSView named it TiPaintView (got .h .m files) and coppied TiPaintView.h and TiPaintView.m files into these and used this new module after process. I got new error

    Script Error = invalid method (createPaintView) passed to TiNewmodModule at app.js

    — commented 4 years ago by nitin soni
  • Ok sorry, for the question I think I have more steps yet to read in
    module development guide.

    — commented 4 years ago by nitin soni

1 Answer

  • Accepted Answer

    "create" methods are implemented automatically by titanium when building modules. What you are looking for is a class probably called (TiPaint)PaintView, where the name in parenthesis is the module name, as explained here

    — answered 4 years ago by Javier Rayon
    1 Comment
    • and note that you shouldn't use NSView, since this is for Mac OS, not for iOS! The iOS equivalent is UIView.

      — commented 4 years ago by Javier Rayon