How to remove dots in UITextfield?

谁说我不能喝 提交于 2019-12-12 04:33:00

问题


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];

Please anyone help me on this.


回答1:


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

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];

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



来源:https://stackoverflow.com/questions/12387703/how-to-remove-dots-in-uitextfield

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!