ImageView更改框架/边界 [英] ImageView changes frame/bounds

查看:39
本文介绍了ImageView更改框架/边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在这里找到此问题,但似乎没有合适的话题...我有一个UINavigationController,可以推送包含图像的各种UIViews.当控制器按下一个新视图时,它将导航栏移到屏幕上,似乎图像随后被挤压"了一下-或从顶部移入"(我希望我对此进行了充分的描述).

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).

无论如何,我的图片具有320x460的帧(由于顶部栏).我找不到合适的设置,图像将保持此大小.它总是做得更小".将新导航栏减去45像素(至320x415)也没有帮助.

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 .:将resizemask设置为0并没有帮助....

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

推荐答案

我通过更改以下内容设法解决了这个问题:

I managed to solve this by changing the following:

我最初使用UIViewController模板创建了一个App.由于我想使用UINavigationController来处理导航,因此我添加了一个并将其放在RootViewController的顶部(!).

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.

这是我认为可能发生的情况:每当我将新视图推入NavigationController时,它似乎就会从上方滑入-我不希望看到的东西.这可能是因为我的NavigationController后面"的UIViewController具有不同的框架布局,即顶部导航栏拍摄的那些像素.

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.

好吧,我最近使用UINavigationController模板创建了一个新的应用程序.我删除了TableView并添加了一个常规视图作为其视图.现在推送和弹出新的视图控制器就可以了-幻灯片不见了:)

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 :)

希望我能帮助别人.

这篇关于ImageView更改框架/边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆