Hello i try to get the width of a UIView Element.
I tested it on an Iphone 4s Emulator.
I have an UIView Element on the main screen. Wich has 20 offset on the left and the right site of the screen.
When i call
UIScreen.mainScreen().bounds.width = 320
but
viewGame.frame.width = 240
but width of viewGame should be 260 so how do i get the real frame width ?
Edit: i am using autolayout to align the view
sorry for bothering. Just after posting this question i found the solution in this post
The problem is that i was calling my functions in the viewDidLoad() function in the view controller. But at this time the layouts havent been aranged yet. Now i call my functions in the viewDidAppear() function and everything works fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With