Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Event issue in iOS Titanium module development

$
0
0

Hello,

In my project (SDK 3.5.0), I try to develop a Titanium module to integrate an iOS component like Android ViewPager (see ICViewPager github project).

This control declares a data source protocol to provides tabs as a list of UIView or a list of UIViewController. From my titanium project, to populate my tabs, I create my controllers from Alloy, and get their view (it seems getting UIViewController is impossible) to my module to fill the data source.

var module = require('com.example.module');
module.createView({
    tabs : [
        { "title" : "My first view", view : Alloy.createController('view1').getView() },
        { "title" : "My second view", view : Alloy.createController('view2').getView() },
        ...
    ]
});
In my module, I've created TiViewPagerController that extends ViewPagerController (the main controller which manage tabs and user interaction) to implement data source and delegate protocols, and in my initializeState method of the module view, I instantiate TiViewPagerController, and adds its view as a child :
- (void)initializeState
{
    [super initializeState];
 
    // Creates and keeps a reference to the view upon initialization
    self.controller = [[TiViewPagerController alloc] init];
    [self addSubview:self.controller.view];
}
The component and my tabs are correctly displayed, user can switch tabs as expected, but all event listeners declared in my Titanium controllers don't work.

I hope that my description is clear, I can provide my code if anyone would help me :)

If you know a free Titanium module that provides an Android ViewPager clone for iOS, I accept you suggestion :)


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>