Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
swift iPad表格视图不透明_Ipad_Swift_Tableview_Transparent - Fatal编程技术网

swift iPad表格视图不透明

swift iPad表格视图不透明,ipad,swift,tableview,transparent,Ipad,Swift,Tableview,Transparent,在swift中,我有一个UI表视图,我将背景设置为透明背景的清晰背景,对于iPhone来说,它工作得非常完美。但对于iPad来说,它不是,它有一个白色的背景,不清晰。我看到了一个答案,但它不是为斯威夫特,但这也不起作用。 我的iPhone代码是: tableview.backgroundcolor = UIColor.clearcolor() 我试着加上: tableview.background = nil 但这不起作用。你在哪里插入代码?我最近在子类化的tableview中遇到了类似的

在swift中,我有一个UI表视图,我将背景设置为透明背景的清晰背景,对于iPhone来说,它工作得非常完美。但对于iPad来说,它不是,它有一个白色的背景,不清晰。我看到了一个答案,但它不是为斯威夫特,但这也不起作用。 我的iPhone代码是:

tableview.backgroundcolor = UIColor.clearcolor()
我试着加上:

tableview.background = nil 

但这不起作用。

你在哪里插入代码?我最近在子类化的tableview中遇到了类似的问题。将背景色设置为clear在iPhone的子类中效果很好,但在iPad上它仍然显示为白色

我的解决方案是,我还必须将它放在包含该表的特定tableViewController上的ViewWillAspect函数中

// myTableViewController
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    myTableView.backgroundColor = UIColor .clearColor()
}

你在哪里插入代码?我最近在子类化的tableview中遇到了类似的问题。将背景色设置为clear在iPhone的子类中效果很好,但在iPad上它仍然显示为白色

我的解决方案是,我还必须将它放在包含该表的特定tableViewController上的ViewWillAspect函数中

// myTableViewController
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    myTableView.backgroundColor = UIColor .clearColor()
}

你在哪里插入代码?我最近在子类化的tableview中遇到了类似的问题。将背景色设置为clear在iPhone的子类中效果很好,但在iPad上它仍然显示为白色

我的解决方案是,我还必须将它放在包含该表的特定tableViewController上的ViewWillAspect函数中

// myTableViewController
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    myTableView.backgroundColor = UIColor .clearColor()
}

你在哪里插入代码?我最近在子类化的tableview中遇到了类似的问题。将背景色设置为clear在iPhone的子类中效果很好,但在iPad上它仍然显示为白色

我的解决方案是,我还必须将它放在包含该表的特定tableViewController上的ViewWillAspect函数中

// myTableViewController
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    myTableView.backgroundColor = UIColor .clearColor()
}

我遇到了同样的问题。似乎在向窗口添加UITableView的过程中(在willMoveToWindow和didMoveToWindow之间),一些iPad将表格视图的背景色重置为白色。它在不使用backgroundColor属性的情况下秘密执行此操作

当我需要一个彩色/透明的表时,我现在使用它作为基类来代替UITableView

class ColorableTableView : UITableView {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}
编辑:在我的iPad上,单元格的背景色也以相同的方式设置为白色(即,移动到窗口时表格中的单元格),因此它们也是如此,以免在重复使用时,偶尔会出现奇怪的不透明单元格

class ColorableTableViewCell : UITableViewCell {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}

我遇到了同样的问题。似乎在向窗口添加UITableView的过程中(在willMoveToWindow和didMoveToWindow之间),一些iPad将表格视图的背景色重置为白色。它在不使用backgroundColor属性的情况下秘密执行此操作

当我需要一个彩色/透明的表时,我现在使用它作为基类来代替UITableView

class ColorableTableView : UITableView {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}
编辑:在我的iPad上,单元格的背景色也以相同的方式设置为白色(即,移动到窗口时表格中的单元格),因此它们也是如此,以免在重复使用时,偶尔会出现奇怪的不透明单元格

class ColorableTableViewCell : UITableViewCell {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}

我遇到了同样的问题。似乎在向窗口添加UITableView的过程中(在willMoveToWindow和didMoveToWindow之间),一些iPad将表格视图的背景色重置为白色。它在不使用backgroundColor属性的情况下秘密执行此操作

当我需要一个彩色/透明的表时,我现在使用它作为基类来代替UITableView

class ColorableTableView : UITableView {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}
编辑:在我的iPad上,单元格的背景色也以相同的方式设置为白色(即,移动到窗口时表格中的单元格),因此它们也是如此,以免在重复使用时,偶尔会出现奇怪的不透明单元格

class ColorableTableViewCell : UITableViewCell {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}

我遇到了同样的问题。似乎在向窗口添加UITableView的过程中(在willMoveToWindow和didMoveToWindow之间),一些iPad将表格视图的背景色重置为白色。它在不使用backgroundColor属性的情况下秘密执行此操作

当我需要一个彩色/透明的表时,我现在使用它作为基类来代替UITableView

class ColorableTableView : UITableView {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}
编辑:在我的iPad上,单元格的背景色也以相同的方式设置为白色(即,移动到窗口时表格中的单元格),因此它们也是如此,以免在重复使用时,偶尔会出现奇怪的不透明单元格

class ColorableTableViewCell : UITableViewCell {
    var _backgroundColor:UIColor?
    override var backgroundColor:UIColor? {
        didSet {
            _backgroundColor = backgroundColor
        }
    }
    override func didMoveToWindow() {
        backgroundColor = _backgroundColor
        super.didMoveToWindow()
    }
}

可能你的iPad手机的背景颜色是默认的
白色
,这就是为什么你看不到它们是半透明的。可能你的iPad手机的背景颜色是默认的
白色
,这就是为什么你看不到它们是半透明的。可能你的iPad手机的背景颜色是默认的
白色
这就是为什么你看不到它们是半透明的。可能你的iPad电池的背景颜色默认为
白色
,这就是为什么你看不到它们是半透明的。