如何删除 UITextfield 中的点? [英] How to remove dots in UITextfield?

查看:26
本文介绍了如何删除 UITextfield 中的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 中,我使用的一个文本字段的文本字段 ID 的长度太长,因此它在文本字段的末尾显示点.我需要删除点.我也用过 lineBreakMode.

In iOS, I am using one text field the length of the text field id too long so it is showing dots at the end of the text field. I need to remove the dots. I have used lineBreakMode also.

查看我正在使用的代码.

See the code I'm using.

CGSize maximumSize = CGSizeMake(titleListTxtFld.frame.size.width, 1000); //here 1000 for maximum height u can increase this if u want
CGSize strSize = [titleListTxtFld.text sizeWithFont:titleListTxtFld.font constrainedToSize:maximumSize lineBreakMode:UILineBreakModeClip];
CGRect newframe = CGRectMake(0, 0, strSize.width, strSize.height);
[titleListTxtFld.text drawInRect:newframe 
                  withFont:titleListTxtFld.font 
             lineBreakMode:UILineBreakModeClip 
                 alignment:UITextAlignmentLeft];

请任何人帮助我.

推荐答案

另一种方法是 (Remove dot and clip text to frame)-

Another approach is (Remove dot and clip text to frame)-

您可以调用以下代码从 UITextField 中删除点

your can remove dot from UITextField calling following code

[self.yourTextField becomeFirstResponder];

您还可以使用以下代码隐藏默认键盘 [如果您使用任何自定义键盘]

you can also hide default keyboard [if you use any custom keyboard] using following code

// Hide keyboard for Dial Pad, but show blinking cursor 
UIView *dummyKeyboardView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
yourTextField.inputView = dummyKeyboardView; 
[dummyKeyboardView release];

但我认为 IlNero 的 answer 更适合您,如果您想显示所有文本(不剪辑).

But I think IlNero's answer is better for you if you want to show all text (does not clip).

这篇关于如何删除 UITextfield 中的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆