Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在第一个视图控制器的导航栏上添加一个徽标,但它的缩放比例很差,因为我不知道最大尺寸是多少。有人知道吗?
顺便说一句,我知道创建全尺寸图像的技巧,但我不想这样做,我只想利用内置的 titleView 属性。
谢谢!
一般来说,我认为标题视图会调整到其他视图左右离开的任何空间。至少这是标准标题视图的行为。
您是否尝试过使用contentMode您的属性UIImageView(我假设您将其放入titleView)?如果没有,请尝试
contentMode
UIImageView
titleView
imageView.contentMode = UIViewContentModeScaleAspectFit;
并尝试一个适合CGRect的frame。如果您的图像足够大以容纳最小的标题视图,那么无论标题视图有多宽,它都应该可以工作。
CGRect
frame