I want to place few buttons/images in my UIView after auto-layout has completed the layout for device on which the app is being run. E.g. in my storyboard, I have screen size set to iPhone 7. But after auto-layout is completed for the device (say iPad), I want to place few UIImagesView
(s). I planned to use viewDidLayoutSubviews
, but seems like it is called after every layout i.e. when my app execution reaches this particular UIViewController
, first viewDidLayoutSubviews
is called for iPhone 7 sized screen and afterwards it adjusts all elements in storyboard for current device size (by doing auto-layout for iPad) and viewDidLayoutSubviews
is called 2nd time afterwards. Now it's a problem for me because the location of imageviews drawn by me depend on location of some elements from storyboard. So essentially, I'm drawing my imageviews twice (once consider iPhone 7 size and 2nd time considering the device size). I only want the latter. Is there a way to know when the auto-layout has happened for the current device size specifically?
Asked
Active
Viewed 118 times
1

hellSigma
- 301
- 4
- 13
-
Please post some code. Also, why are you trying to place things *after* auto layout instead of simply including them *in* your auto layout? – Feb 02 '17 at 02:23
-
I'm trying to add them programmatically instead of adding them in Storyboard. The reason being that there are too many of them to add manually. Not sure what code I should post here, since it's not a programming related question but more of a conceptual question. But let me think, will try to post something relevant soon. – hellSigma Feb 02 '17 at 05:15