![](/img/trans.png)
[英]How to create Titanium View Proxy Method and access it from titanium project?
[英]How to call methods in the custom view in iOS module, from titanium project?
我需要從Titan項目在iOS模塊的自定義視圖中調用方法。 我已遵循Appcelarator文檔中有關創建iOS模塊的教程。 我可以使用以下代碼在Titanium中創建自定義視圖。
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 Module項目中viewProxy類中的代碼。 請幫忙。
我知道這已經晚了,但是對於任何想知道的人來說,我的理解是,即使您不打算為您的方法傳遞參數,該方法在本機模塊中的簽名也應該始終采用一個:
你的方法
- (void) customMethodInView;
應該看起來像這樣:
- (void)customMethodInView:(id)unused;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.