简体   繁体   English

使用 UIGuesture 使用 UITextview 调整 UIImageview 的大小

[英]Resizing UIImageview with a UITextview using UIGuesture

I'm new in Iphone.我是 Iphone 的新手。 I have an UITextView inside a UIImageView .我在UIImageView中有一个UITextView Now I need to dynamically resize the UIImageView so that its textview also change its size dynamically.现在我需要动态调整UIImageView的大小,以便它的 textview 也动态改变它的大小。 Moreover I can move this UIImageView with UITextView around the screen.此外,我可以用UITextView在屏幕上移动这个UIImageView If any one knows this using UIGuesture please help me.如果有人使用UIGuesture知道这一点,请帮助我。

Any help would be appreciated任何帮助,将不胜感激

  1. If you are looking at resizing the UIImageView object, look at the UIPinchGestureRecognizer .如果您正在考虑调整UIImageView object 的大小,请查看UIPinchGestureRecognizer It will have a property called scale that you can use to change its size.它将有一个名为scale的属性,您可以使用它来更改其大小。
  2. As for the UITextView object that is the subview, you can look at autoresizingMask property inherited from UIView .至于作为子视图的UITextView object,您可以查看从UIView继承的autoresizingMask属性。 Set it appropriately so that the text view scales in response to its super view.适当地设置它,以便文本视图缩放以响应其超级视图。
  3. For moving the image view, you can use the UIPanGestureRecognizer .要移动图像视图,您可以使用UIPanGestureRecognizer You can get the translation using translationInView: .您可以使用translationInView:获取翻译。 Use this to modify the center of the image view object.使用它来修改图像视图 object 的中心。 This should move the image view as you drag your finger around.这应该会在您拖动手指时移动图像视图。

I hope you've gone through the guide .我希望你已经阅读了guide Let us know if you face problems implementing this and put some code so that we can guide you in the right direction.如果您在实现此功能时遇到问题,请告诉我们并添加一些代码,以便我们可以引导您朝着正确的方向前进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM