lee
lee

Reputation: 8105

Binary operator * cannot be applied to operands of type Int and CGFloat

i had type Int. please help me fix that?

enter image description here

Upvotes: 28

Views: 29423

Answers (2)

Epic Defeater
Epic Defeater

Reputation: 2147

Instead of i * self.view.frame.size.width, use CGFloat(i) * self.view.frame.size.width

Upvotes: 59

Chetan9007
Chetan9007

Reputation: 908

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)

Upvotes: 2

Related Questions