Próbuję uzyskać przejrzystość NativeScript <ListView>
w systemie iOS i nie udało mi się. Znalazłem stary wątek na temat na https://groups.google.com/forum/#!topic/nativescript/-MIWcQo-l6k, ale kiedy próbuję rozwiązanie to nie działa dla mnie. Oto mój pełny kod:Tworzenie przejrzystego widoku listy NativeScript na iOS
/* app.css */
Page { background-color: black; }
<!-- main-page.xml -->
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="loaded">
<ListView id="list-view" items="{{ items }}" itemLoading="itemLoading">
<ListView.itemTemplate>
<Label text="{{ name }}" />
</ListView.itemTemplate>
</ListView>
</Page>
// main-page.js
var ios = require("utils/utils");
var Observable = require("data/observable").Observable;
var ObservableArray = require("data/observable-array").ObservableArray;
var page;
var items = new ObservableArray([]);
var pageData = new Observable();
exports.loaded = function(args) {
page = args.object;
page.bindingContext = pageData;
// Toss a few numbers in the list for testing
items.push({ name: "1" });
items.push({ name: "2" });
items.push({ name: "3" });
pageData.set("items", items);
};
exports.itemLoading = function(args) {
var cell = args.ios;
if (cell) {
// Use ios.getter for iOS 9/10 API compatibility
cell.backgroundColor = ios.getter(UIColor.clearColor);
}
}
Każda pomoc będzie mile widziane. Dzięki!
Aby wyjaśnić przyszłym pracownikom Google, użyj tego + kodu "itemLoading" TJ, aby zniknęło tło ListView iOS. Potrzebujesz obu. – Todd