swift - Increase UIButton size for bigger screens dynamically -
i creating buttons (and other objects) programatically, prefer. see below example:
let loginbutton: uibutton = uibutton( frame: cgrect( x: 0, y: 0, width: uiscreen.mainscreen().bounds.width / 1.5, height: 50 ) )
here create button screen width / 1.5 wide , 50px heigh. size perfect iphone 4s resolution , other devices, horizontally, takes screen width account. however, naturally, when running on larger resolution device iphone 6/6+, buttons still 50px tall, little , leaving lot of content space empty.
i sure there way probe content scale programatically can calculate right height buttons, depending on device size.
i'm new apple's api's , shove in right direction, or little illustration great.
ps: want go on creating interfaces programatically, not using interface builder. please refrain suggesting of sort.
thanks in advance.
swift uibutton
No comments:
Post a Comment