I am working on a custom module for iOS in Titanium. In that module I need to get an UIView
object. For example, user is creating a view with method Ti.UI.createView
in javascript, then I need solution to get that view as UIView
in my module objective-C code.
javascript:
MyModule.getView({ view: sampleView });
objective-c:
-(void)getView:(id)args{
//some objective-C code to get UIView from args
}
Can anyone help me with that?
Here is the answer, that works for me
javascript:
MyModule.getView( view );
objective-c:
-(void)getView:(id)args {
TiUIViewProxy* viewProxy = (TiUIViewProxy*)[args objectAtIndex:0];
UIView *view = (UIView*)[viewProxy view];
}
The view
will actually be a TiUIView class object, which inherits from UIView.