swift - How to create a UIButton and set frame using CGRect? -


hello ask question, if in object c create button given position (eg)

   # define kwidthbutton 120     # define kheightbutton 80      - (uibutton*)createbuttonwithindex:(int)index{    int row = index / 2;     int column = index %2;     uibutton * newbutton = [uibutton buttonwithtype: uibuttontyperoundedrect];    newbutton.frame = cgrectmake (* kwidthbutton column, row * kheightbutton, kwidthbutton, kheightbutton);     } 

how can make swift ?

i found create button can way value index in swift

let button   = uibutton.buttonwithtype(uibuttontype.system) uibutton     button.frame = cgrectmake(100, 100, 100, 50) 


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -