CEMKit-Swift
CEMKit-Swift copied to clipboard
Practical use of leftWithOffset
func leftWithOffset(offset: CGFloat) -> CGFloat {
return self.left - offset
}
func rightWithOffset(offset: CGFloat) -> CGFloat {
return self.right + offset
}
func topWithOffset(offset: CGFloat) -> CGFloat {
return self.top - offset
}
func bottomWithOffset(offset: CGFloat) -> CGFloat {
return self.bottom + offset
}
Where do you use these methods? Thanks for the extensions
hi, thanks ! you can use them for laying out your views manually for example, if you want align two views horizontally with 10px padding
let padding: CGFloat = 10
let viewW: CGFloat = (self.view.w - padding*3) / 2
let viewH: CGFloat = 50
let firstView = UIView(x: padding, y: padding, w: viewW, h: viewH)
self.view.addSubview(firstView)
let secondView = UIView(x: firstView.rightWithOffset(padding), y: padding, w: viewW, h: viewH)
self.view.addSubview(secondView)
I didn't understand it with your code but tested and it is perfectly thought out. http://prntscr.com/7sz6v7
Sorry to barrage you with questions but,
-
Btw couldn't get this one to work drawArc(), what am I missing?
-
Do you use spring() except for pop()?
-
toImage() this only turns it to black and white images, is it how this is intended to be used?
-
addTapGestureWithOverlay whats this intended for?
-
How do you use these?
public init(stringLiteral value: StringLiteralType) { self = CGPointFromString(value) }
public init(extendedGraphemeClusterLiteral value: StringLiteralType) { self = CGPointFromString(value) }
public init(unicodeScalarLiteral value: StringLiteralType) { self = CGPointFromString(value) }
-
For what do you use these?
normalizeValue convertNormalizedValue clamp aspectHeightForTargetAspectWidth aspectWidthForTargetAspectHeight
- How do you use BlockButton?
I am still wondering about these :)