将 UImageVIew 插入 UITextField

发布于 2024-08-16 16:41:48 字数 81 浏览 3 评论 0原文

如何将图像添加到文本字段?我在一些应用程序中看到了它,但无法绕过它。同样基于光标的位置,imageView 将被初始化(将图像添加到下一行)。谢谢。

How can I add an image to a textfield? I saw it in a few apps, but can't get around it. Also based on the location of the curser, the imageView will be initialized (add image to next line). Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

前事休说 2024-08-23 16:41:48

如果您真的意味着将图像插入文本字段的文本框中,我认为这是不可能的。你想实现什么目标?可能有更合适的方法来做到这一点。

If you really mean insert an image into the text box of the textfield I don't believe this is possible. What are you trying to accomplish? There are probably more appropriate ways of doing it.

你的呼吸 2024-08-23 16:41:48

是的,我们可以使用以下代码将 imageview 插入文本字段。

 UIImageView *myView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"text_line.png"]];
 myView.center = CGPointMake(5, 27);                     
 [letterField insertSubview:myView atIndex:0];// mgViewTitleBackGround is image
 [myView release];

浏览一下这段代码。

Yes We can insert imageview into textfield with the following code.

 UIImageView *myView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"text_line.png"]];
 myView.center = CGPointMake(5, 27);                     
 [letterField insertSubview:myView atIndex:0];// mgViewTitleBackGround is image
 [myView release];

Go through this code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文