‘CGFloat’ is not convertible to ‘UInt8' and other CGFloat issues with Swift and Xcode 6 beta 4

前端 未结 4 1234
孤街浪徒
孤街浪徒 2020-12-11 02:09

In case this illuminates the problem, here\'s the original Objective-C code.

int x = (arc4random()%(int)(self.gameView.bounds.size.width*5)) - (int)self.game         


        
4条回答
  •  借酒劲吻你
    2020-12-11 02:26

    Had the same problem ... try wrapping

    arc4random_uniform 
    

    with

    Int()
    

    like

    Int(arc4random_uniform)
    

    this worked for me ... don't know why Swift/Xcode hast problems converting unsigned INT's

提交回复
热议问题