Why float variable and int variable unable to multiple? why not result value failed to typeCast here! You comments help! let price : Float = 10.5 let quantity : Int = 20 var total : Float. total = price * quantity.
– KkMIW
2 Answers
56
votes
Instead of i * self.view.frame.size.width, use CGFloat(i) * self.view.frame.size.width
2
votes
You need to type cast i into CGFloat, write your line of code as
var frame: CGRect = CGRectMake(CGFloat(i) * self.view.fram.size.width, self.tutorialHolderView.frame.origin.y, 0, self.tutorialHolderView.frame.size.height)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more