无法在 UIToolbar 中添加超大按钮
我在 IB 中有一个 UIToolbar,其中有一个设置为图像的自定义 UIBarButtonItem。图像高度大于 UIToolbar 高度。由于某种原因图像无法加载。附上一张截图。
I have a UIToolbar in IB with a custom UIBarButtonItem that is set to an image. The image height is larger than the UIToolbar height. The image does not load for some reason. Attached is a screenshot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该避免使用大于父视图的子视图 - 即使它确实有效并在边界之外绘制视图,您也不能总是指望它,因为出于性能原因并且根据重叠部分的绘制顺序,会跳过裁剪稍后可能会介绍子视图的内容。第二个问题是,只有超级视图框架内的部分能够处理触摸事件。
至于为什么看不到自己的图像,可能是另一个问题,我怀疑它与超出框架有关。发布您的代码以获得更多反馈;)
You should avoid using subviews that are larger than the parent view - even if it does work and draws the view outside of the bounds, you cannot always count on it because the clipping is skipped for performance reasons and depending on the drawing order the overlapping part of the subview might be covered later. Second problem is that only the part within the frame of the superview is able to handle the touch events.
As to why you don't see your image, it's probably a different problem, I doubt it has something to do with it going outside the frame. Post your code to get more feedback ;)