mardi 7 avril 2015

addSubview to an SpringView

I use the Spring library (http://ift.tt/1tMhamB) to add iOS animations to my Swift project. I have a custom subclass ChooseButton of SpringView and I want to add a subview (mySubView in this case) to this view :



class ChooseButton: SpringView {
enum TypeButton {
case YES, NO
}

var type:TypeButton!
var size:CGFloat = 90

var enabled: Bool!
var delegateButton: ChooseButtonDelegate?

init (type: TypeButton) {
super.init(frame: CGRectMake(0,0,size,size))
self.type = type
enabledButton()
if type == TypeButton.YES {
self.backgroundColor = CustomColor.Emeralde
self.center = CGPointMake(gScreenSize.width*3/4, gScreenSize.height-self.frame.size.height)
} else {
self.backgroundColor = CustomColor.Alizarin
self.center = CGPointMake(gScreenSize.width/4, gScreenSize.height-self.frame.size.height)
}
self.layer.cornerRadius = size/2

var mySubView = UIView(frame: frame)
mySubView.backgroundColor = UIColor.blackColor()
addSubview(mySubView)
}


But my Subview does not shows up... I can't see why.


Aucun commentaire:

Enregistrer un commentaire