i have one view and set multiple subviews on the view, my subviews is dynamically created, i want all subview in centre and auto resizable, so how can do it.
for(i=1; i<answer.characters.count; i++) {
             ansview = UIView(frame: CGRectMake(viewwidth-5, 10, 30, 30))
            ansview.layer.cornerRadius = 0.2 * btn.bounds.size.width
            ansview.backgroundColor = UIColor.grayColor()
            ansview.tag = i;
            viewAnswer.addSubview(ansview)
            viewwidth = viewwidth + 35
}
this type of output generated to this code, so how can do it i am new in swift. thanks...

 
     
    
 
    