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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -