2016-10-31 18 views
0

我需要在鈦項目的iOS模塊的自定義視圖中調用方法。我遵循了Appcelarator文檔中有關創建iOS模塊的教程。我可以使用下面的代碼在Titanium中創建自定義視圖。如何從鈦項目調用iOS模塊中的自定義視圖中的方法?

var manage = require('com.test'); 
var manageView = manage.createView({ 
left:40, 
right:40, 
top:40, 
height: 250, 
backgroundColor:'blue' }); manageView.customMethodInView(); 

但我得到了錯誤,如「customMethodInView是不是一個函數」當我運行的應用程序。

#import "TiViewProxy.h" 
#import "CustomView.h" 

@interface ComTestViewProxy : TiViewProxy { 
    CustomView *customView; 
} 
- (void) customMethodInView; 
@end 

這是iOS模塊項目中的viewProxy類中的代碼。 請幫忙。

+0

你進入橋接報頭爲TiViewProxy在OBJ-c和你正在使用SWIFT –

回答

0

我知道這是遲到的,但對於任何想知道的靈魂,我的理解是,即使你不打算爲你的方法傳遞參數,本地模塊中方法的簽名應該總是之一:

你的方法

- (void) customMethodInView; 

應該是這樣的:

- (void)customMethodInView:(id)unused; 
相關問題