Q: Creating a label using the iAd JS Declarative interface
Hello!
I'm trying to create a simple label in a HTML Object.
I've got this to files imported:
main.js:
iAd.Class({
name: 'AppController',
superclass: iAd.RootViewController
});
AppController.prototype.init = function() {
this.callSuper();
this.proba = new ProbaController();
iAd.RootView.sharedRoot.addSubview(this.proba.view);
};
window.addEventListener('DOMContentLoaded', function () {
window.controller = new AppController();
}, false);
proba.js
iAd.Class({
name: 'ProbaController',
superclass: iAd.ViewController
});
ProbaController.prototype.init = function () {
this.callSuper();
};
ProbaController.prototype.viewDidLoad = function() {
this.outlets.texto = "Ola";
}
Finally, in the HTML object, this code:
<!DOCTYPE html>
<head>
<title>Proba</title>
</head>
<body class="ad-root-view">
<div id="PROBA" class="ad-label"
data-ad-number-of-lines="0"
ad-outlet="texto">
</div>
</body>
</html>
What I want is to create a label in the HTML object with text, for example, "Ola", but I'm affraid I'm doing something wrong.
I'll appreciate any help, please.
Thanks in advance!
iPad 3G, iOS 7.1.1
Posted on May 16, 2014 11:14 AM