ios - Get Screen size in Swift as Integer -


for positioning element random in screen within boundarys need resolution/screen size in swift. fount out how cggraphics. unfortunately have calculate bit , need type uint32, not cgfloat. cannot use casting way. ideas?

let screensize: cgrect = uiscreen.mainscreen().bounds let screenwidth = screensize.width //what want let screenheight = screensize.height-arc4random_uniform(screensize.height) 

if want random x , y positions element can this:

let screensize = uiscreen.mainscreen().bounds let randomxpos = cgfloat(arc4random_uniform(uint32(screensize.width))) let randomypos = cgfloat(arc4random_uniform(uint32(screensize.height))) 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -