为什么在我的UIcolour中出现这个错误?

问题描述:

func changeColor(sender: UIButton) { 
    self.view.backgroundColor = UIColor.randomColor() 
} 

生成错误: - Type 'UIColor' has no member 'randomColor'为什么在我的UIcolour中出现这个错误?

+0

@ user5473955-对于UIColor(),他们没有方法randomcolor那就是为什么你得到这个错误。 –

这是因为在UIColor上没有方法randomColor方法。

有关可用方法,请参阅UIColor Documentation