2

私はPhoneGapに取り組んでいます。JavaScript関数呼び出し時にUIButtonに画像を設定する必要があります。

目的の c 'Myfunction' を呼び出すには、このコードを使用しました--

PhoneGap.exec("MyClass.Myfunction", types);

目的の c メソッドを呼び出して、ヘルプ ボタンに画像を設定することができます--

MainViewController * _mainViewController=[[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil];
[_mainViewController.help setBackgroundImage:[UIImage imageNamed:@"back.png"]forState:UIControlStateNormal];

ただし、null オブジェクトを取得します。

誰でも私を助けることができます..?

4

1 に答える 1

1

MainViewController * _mainViewController=[[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil];

これを使用して新しいオブジェクトを作成しているため、ボタンに画像を設定できません。

を呼び出すと、ボタンに画像を設定できますPhoneGap.exec

于 2012-05-18T07:57:50.337 に答える