基于触摸创建形状
我想根据触摸和触摸在iPhone屏幕上绘制不同的形状。想给它起个名字。
假设用户触摸屏幕上的 4 个点,那么它将在屏幕上创建 4 个点,最终创建一个矩形。
然后假设我想为该形状命名,我应该能够通过在该形状旁边输入一些文本来为其命名。
到目前为止,我可以基于触摸在屏幕上绘制点,并且基于点我还可以在屏幕上绘制连续的线。
但我不明白如何创建形状,因为它在视觉上显示为特定形状,但实际上并非如此,以及如何在这些形状内输入一些文本。
I want to draw different shapes on iphone screen based on touch & want to give a name to it.
Suppose user touch at 4 points on the screen then it will create 4 dots on screen which ultimately create a rectangle.
Then suppose i want to give a name to that shape, i should be able to give a name to it by entering some text in side that shape.
Till now i can able to draw dots on the screen based on touch and based on dot i also able to draw a continuous line on screen.
But i dont understand how can create the shape as visually it is displaying like a particular shape but in reality it is not and how can i enter some text inside these shape.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
获取这四个点并创建一个与这些点匹配的新 UIView。将其添加到主视图中。如果该视图是 UILabel,您可以轻松地在其中添加文本。如果是 UITextField,则用户可以使用标准 iOS 文本编辑方法“点击文本字段,键盘出现”。
Get the four points and create a new UIView matching those points. Add it to the main view. If that view is a UILabel, you can readily add text inside it. If a UITextField, then users can use the standard iOS text editing approach of "tap text field, keyboard appears".