简体   繁体   中英

Cannot invoke '+' with an argument list of type '(frame: CGRect)'

I am trying to create a UIView from a CGRect frame. Every parameter in CGRectMake() are CGFloats.

var views:UIView = UIView(frame:CGRectMake(CGFloat(hotspotScroll.frame.size.width * i + 20), CGFloat(10),CGFloat(hotspotScroll.frame.size.width - 40), CGFloat(hotspotScroll.frame.size.height - 20)))

But it gives me an error:

Cannot invoke '+' with an argument list of type '(frame: CGRect)'

Why is that?

i需要成为*+CGFloat才能正确解决:

var views:UIView = UIView(frame:CGRectMake(CGFloat(hotspotScroll.frame.size.width * CGFloat(i) + 20), CGFloat(10),CGFloat(hotspotScroll.frame.size.width - 40), CGFloat(hotspotScroll.frame.size.height - 20)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM