uitextfield

Cursor visibility issue in ios7

早过忘川 提交于 2020-01-01 04:04:03
问题 Simply creating a UITextField in ios7 SDK but when I enter some input, text is shown UItextField but cursor isn't. Any clue about what can be the problem? 回答1: Change the tintColor of the UITextField with a cursor [mobileTextField setTintColor:[UIColor blueColor]]; if you are use the XIb please set the tin color of UITextField Note :- This is working on IOS 7+ 回答2: As @Deepesh said, it's a matter of choosing the proper tint color. However it was not enough in my case since I am creating the

Objective-C: Numbers only text field? [duplicate]

南笙酒味 提交于 2020-01-01 04:01:23
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Iphone UITextField only integer I want to place a text field that only accepts numbers (0-9, doesn't even need decimals), but even using the "Number Pad" entry option I still get a keyboard with various symbols on it. Is there a better control for this, is there a better control for what I'm doing, or do I just have to validate input manually? 回答1: The following code will allow you to only input numbers as well

Display UIMenuController in editingDidBegin of a UITextField

非 Y 不嫁゛ 提交于 2020-01-01 03:47:06
问题 I simply want to display the UIMenuController right after a textfield has become active. What i'm doing right now is: - (IBAction)textFieldeditingDidBegin:(UITextField *)sender { // textfield menu item UIMenuController *menu = [UIMenuController sharedMenuController]; [menu setTargetRect:sender.frame inView:self.view]; [menu setMenuVisible:YES animated:YES]; } The method gets called but it just will not display the menu... If i do a touch+hold gesture on the textfield it comes up regularly. I

IOS 7 UITextField resignFirstResponder BAD

萝らか妹 提交于 2020-01-01 02:41:26
问题 Im getting a crash, when using a UItextField, inside my customCell, and when i resignFirstResponder the textfield, but its not visible anymore(the table view scrolled out of window). I still can find the textfield, the pointer continues accessible, it is no null, and the crash only occurs on IOS7, on IOS6 i dont have this problem. Heres some code : The textField is a global variable. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

Only allow letters and numbers for a UITextField

半腔热情 提交于 2020-01-01 00:49:15
问题 I have a signup view controller where the user needs to enter an email address, a username, and a password. For the username and password fields, right now you can currently sign up with a username like "user%$&" and a password like "password%^&$". I don't want people to be able to use these special characters. I want to make it so that the username and password fields can only be submitted with alphanumeric characters aka letters and numbers. I have found some methods to do this, but they

is this CoreText? - Aviary text pinch zoom expand

青春壹個敷衍的年華 提交于 2019-12-31 22:49:09
问题 I am looking into making an app where a user can change the size and orientation of UITextField . I was looking into Aviary app and what I see is that users can not only increase or decrease the size of the text but they can also change its orientation. So the questions I want to ask are 1) Are they using CoreText to do this are they using just plain old UILabel or UIText ? 2) I don't know how you can dynamically resize? Are they using UIView ? 3) I have googled CoreText tutorials, examples,

How to delete the contents of a UITextField programmatically?

霸气de小男生 提交于 2019-12-31 06:59:20
问题 I am writing an iPhone app that has a number of UITextFields that requires the user to input a bunch of data. I would like to have a simple 'delete' facility that allows the user to discard any data they have put in to the multiple fields. I've been struggling with this issue for a few days now. I can't seem to find a way of reaching into the individual text fields and changing the text. My app throws errors at me no matter what I try. 回答1: There are several ways of tackling this. You can

UICollectionView - When the keyboard appears the entire collection view is shifted with the keyboard

 ̄綄美尐妖づ 提交于 2019-12-31 05:40:30
问题 This isn't my desired effect. This only happens when the collection view is set to horizontal flow layout. I've seen a few other posts regarding this very same issue but none of the provided answers have worked. Has anyone found a solution? I've provided two screenshots showing a UITextField before the keyboard is triggered and after. As you can see the UITextField along with the entire collection view (which can't be seen) is pushed up along with the keyboard. Usually the keyboard is

UITextField inside an UIAlertView not working in iOS4.1 and works in 3.0

∥☆過路亽.° 提交于 2019-12-31 05:12:06
问题 I have a UITextField added to an UIAlerView (Kind of adding user to list with nick name, and nickname is asked by the alertview.). Thats work perfect in iOS3, But I cant type to that UITextField in iOS4.1. in iOS4.1 I do get focus to that textfield inside alertview, and keyboard appears, however typing doesn't work. Please help in this regard. 回答1: In iOS 4 UIAlertViews will automatically be moved and sized to avoid the keyboard if they contain any UITextFields in their subviews so you don't

UITextField - Dismiss keyboard when two digits have been entered

孤人 提交于 2019-12-30 12:25:11
问题 I have a UITextField, which uses a number pad to take input. How can I dismiss it/run a method call when two digits have been entered into the textField? 回答1: -(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ int count = [textField.text length]; if(count>=2){ [textField resignFirstResponder]; } return YES; } 回答2: Use the text field delegate method: - (BOOL)textField:(UITextField *)textField