问题
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