寻求 Objective C 示例
我正在尝试向 IKImageView 添加滚动条。基本上目前,我需要一些将图像加载到视图中的程序示例,如果窗口太小,则设置滚动条来执行正确的操作...
为什么我在苹果开发人员上找不到这些示例地点?
添加信息:
查看 ImagekitDemo 后,我发现显然我确实需要将 IKIMageView 嵌入 ScrollView 中。 (不知何故,这使得 IKImageView 的 has___Scroller 属性为 YES...)
但是,现在(在 ImageKitDemo 中也是如此)只要只需要一个(或两个都不需要)滚动条就可以了。但是,一旦需要两者,并且窗口的任一尺寸小于图像,两个滚动条都会消失。
鼠标滚动仍然有效。
I'm trying to add scrollbars to an IKImageView. Basically at the moment, I need some examples of a program that loads an image into a view, and if the window is too small, sets up scrollbars that do the right things...
Why can I not find these examples on the apple dev site?
Added info:
After looking at ImagekitDemo I see that evidently I DO need to embed the IKIMageView in a ScrollView. (and somehow that makes the has___Scroller properties of the IKImageView YES...)
However, now (And this is true in ImageKitDemo as well) The scroll bars are fine as long as only one (or neither) is needed. However, as soon as both are needed, and either dimension of the window is smaller than the image, BOTH scrollbars disappear.
Mouse scrolling still works.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ZoomViewController.h
ZoomViewController.m
ZoomViewController.h
ZoomViewController.m
最好的起点是 滚动视图编程指南。基本上,您需要将 IKImageView 放入 NSScrollView 中。如果 IKImageView 大小超过 NSScrollView 的可见矩形,则会出现滚动条。
以下示例使用 IKImageView 执行各种缩放和调整大小操作。
The best place to start is the Scroll View Programming Guide. Basically, you need to put the IKImageView inside a NSScrollView. If the IKImageView size exceeds the visible rectangle of the NSScrollView, then scrollbars will appears.
The following sample uses IKImageView to perform various zoom and resizing operations.