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.