ImageView changes frame/bounds

大兔子大兔子 提交于 2020-01-25 03:05:07

问题


I have been trying to find this issue here, but no topic seems to fit... I have a UINavigationController that pushes different kinds of UIViews containing images. When the controller pushes a new view, it the navigation bar is moved onto the screen and it appears that the image subsequently is being 'squelched' a bit - or it 'moves in from top' (I hope I described this sufficiently).

Anyway, my image has the frame of 320x460 (because of the top bar). I couldnt find a proper setting, where the image would remain in this size. It is always 'made smaller'. Subtracting 45 px for the new navigation bar (to 320x415) didnt help either.

What am I missing? Any clues are welcome!

P.S.:Setting the resizemask to 0 didnt help either....


回答1:


I managed to solve this by changing the following:

I initially created an App using the UIViewController template. Since I wanted to use a UINavigationController to handle my navigation, I added one and put it on top(!) of my RootViewController.

Here's what I think might have happened: Whenever I pushed a new view onto my NavigationController it seemed to slide in from above - something I didn't want to see. This may be because the UIViewController 'behind' my NavigationController had a different frame layout, namely those pixels taken by the top navigation bar.

Well, I created a new App recently, using the UINavigationController Template. I deleted the TableView and added a regular view as its view. Now pushing and popping new view controllers works just fine - the slide is gone :)

Hope I could help someone.



来源:https://stackoverflow.com/questions/2881905/imageview-changes-frame-bounds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!