使用 UIGuesture 调整 UIImageview 和 UITextview 的大小
我是 iPhone 新手。我在 UIImageView
中有一个 UITextView
。现在我需要动态调整 UIImageView 的大小,以便其文本视图也动态更改其大小。此外,我可以在屏幕上移动这个 UIImageView
和 UITextView
。如果有人使用 UIGuesture
了解这一点,请帮助我。
任何帮助将不胜感激
I'm new in Iphone. I have an UITextView
inside a UIImageView
. Now I need to dynamically resize the UIImageView
so that its textview also change its size dynamically. Moreover I can move this UIImageView
with UITextView
around the screen. If any one knows this using UIGuesture
please help me.
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIImageView
对象的大小,请查看UIPinchGestureRecognizer
。它将有一个名为scale
的属性,您可以使用它来更改其大小。UITextView
对象,您可以查看从UIView
继承的autoresizingMask
属性。适当地设置它,以便文本视图根据其超级视图进行缩放。UIPanGestureRecognizer
。您可以使用translationInView:
获取翻译。使用它来修改图像视图对象的中心。当您拖动手指时,这应该会移动图像视图。我希望您已经完成了
指南
。如果您在实现此功能时遇到问题,请告诉我们,并提供一些代码,以便我们可以引导您走向正确的方向。UIImageView
object, look at theUIPinchGestureRecognizer
. It will have a property calledscale
that you can use to change its size.UITextView
object that is the subview, you can look atautoresizingMask
property inherited fromUIView
. Set it appropriately so that the text view scales in response to its super view.UIPanGestureRecognizer
. You can get the translation usingtranslationInView:
. Use this to modify the center of the image view object. This should move the image view as you drag your finger around.I hope you've gone through the
guide
. Let us know if you face problems implementing this and put some code so that we can guide you in the right direction.