在iOS上使NativeScript ListView透明

在iOS上使NativeScript ListView透明,nativescript,Nativescript,我试图让NativeScript在iOS上透明,但失败了。我在上找到了一个关于这个主题的旧线程,但当我尝试解决方案时,它对我不起作用。以下是我的完整代码: /* app.css */ Page { background-color: black; } 任何帮助都将不胜感激。谢谢 别忘了将listview设置为透明,它本身似乎有背景色 ListView{ background-color: transparent; } 目前,在NativeScript 2.4

我试图让NativeScript
在iOS上透明,但失败了。我在上找到了一个关于这个主题的旧线程,但当我尝试解决方案时,它对我不起作用。以下是我的完整代码:

/* app.css */
Page { background-color: black; }


任何帮助都将不胜感激。谢谢

别忘了将listview设置为透明,它本身似乎有背景色

    ListView{
        background-color: transparent;
    }

目前,在NativeScript 2.4中,以下工作

var cell = args.ios;
if (cell) {
  cell.selectionStyle = UITableViewCellSelectionStyleNone
}
如果你想在这里改变选择突出显示的颜色,这是一个简单的方法,我还没有测试过性能,但它在iPhone 6上可以正常工作

import { Color } from 'color';
cell.selectedBackgroundView = UIView.alloc().initWithFrame(CGRectMake(0, 0, 0, 0));
let blue = new Color('#3489db');
cell.selectedBackgroundView.backgroundColor = blue.ios

不确定是否有更好的方法可以做到这一点,但这正是我在iOS上使用NativeScript 2.4时所做的工作:A)使ListView背景透明,B)在点击某个项目时更改颜色:

let lvItemLoading = (args) => {
   let cell = args.ios;
   if (cell) {
      // Make the iOS listview background transparent
      cell.backgroundColor = ios.getter(cell, UIColor.clearColor);

      // Create new background view for selected state
      let bgSelectedView = UIView.alloc().init();
      bgSelectedView.backgroundColor = new Color("#777777").ios;
      bgSelectedView.layer.masksToBounds = true;
      cell.selectedBackgroundView = bgSelectedView;
   }
};

为了给未来的谷歌用户澄清,使用这个+TJ的
itemLoading
代码使iOS ListView背景消失。两者都需要。我如何才能访问UITableViewCellSelectionStyleNone?它来自UITableViewCellSelectionStyle,但我找不到Webstorm的合适导入。谢谢你的回答。你好,大卫。
import { Color } from 'color';
cell.selectedBackgroundView = UIView.alloc().initWithFrame(CGRectMake(0, 0, 0, 0));
let blue = new Color('#3489db');
cell.selectedBackgroundView.backgroundColor = blue.ios
let lvItemLoading = (args) => {
   let cell = args.ios;
   if (cell) {
      // Make the iOS listview background transparent
      cell.backgroundColor = ios.getter(cell, UIColor.clearColor);

      // Create new background view for selected state
      let bgSelectedView = UIView.alloc().init();
      bgSelectedView.backgroundColor = new Color("#777777").ios;
      bgSelectedView.layer.masksToBounds = true;
      cell.selectedBackgroundView = bgSelectedView;
   }
};