uitextfield

How to disable UIAlertAction depending on UITextField in UIAlertController?

末鹿安然 提交于 2020-01-02 04:45:08
问题 I'm using a UIAlertController to present the user with a dialog to enter a 5 digit CRN . I want the Add button to be disabled until there are 5 and only 5 digit in the UITextField . Here's what the UI looks like : Here's the properties setup for the UIAlertController : var alertController: UIAlertController! var addAlertAction: UIAlertAction! { return UIAlertAction(title: "Add", style: .default) } Here's how I'm initializing them in the viewDidLoad method : self.alertController =

Adjust width of UITextField to fill toolbar in landscape

爱⌒轻易说出口 提交于 2020-01-02 03:40:27
问题 In a UIToolbar , I have added a UITextField to the middle of the bar (which gets added as a UIBarButtonItem ) with another UIBarButtonItem (Action button) next to it. I added flexible space bar button items at the very left and very right. It looks great on portrait, but when I rotate to landscape it centers them and looks ok, but I need the text field to get stretched to fill the width and push the last button clear to the right - exactly like it does in Messages - on iPhone and iPad. I

UITextField auto-suggest from a large database

强颜欢笑 提交于 2020-01-01 19:19:08
问题 I am trying to add suggestions for a UITextField. They show up as a UITableView below the text field that displays a few entries according to what the user is typing (like Google Suggest for example). The only method I tried so far is a select from an internal SQLite database. This works, but it is extremely slow as the database is really large (approx. 35000 entries). Everytime something is typed, the app freezes for 4 or 5 seconds before showing up new suggestions. So I guess this method

Cursor goes to end after setting text to UITextField inside shouldChangeCharactersIn

爱⌒轻易说出口 提交于 2020-01-01 17:28:11
问题 I have text label which has phone number in it. I mask the phone number when user is typing so that in shouldChangeCharactersIn function; I get user input (string) Add that input to text which is already written in UITextField Mask text and set it to UITextField Return false My question is that after I set text of UITextfield (delete or add new character UITextField , cursor moves to the end but I want it to stay in the same position. (By meaning same position, I mean same when I don't

iOS 8 broke UIPickerView in UIActionSheet

烂漫一生 提交于 2020-01-01 12:11:04
问题 I was presenting a picker in UIActionSheet very simply up until iOS 8. Now, it seems they have broken that capability with the latest update. It was never supported and the practice was discouraged in the docs all along. Presumably the entire UIActionSheet capability is deprecated and will not be supported going forward. The documentation says to use UIAlertController instead. I have tried switching to the UIAlertController and actually found what I initially expected would be a nicer

How to set a custom color in itext?

非 Y 不嫁゛ 提交于 2020-01-01 09:12:34
问题 Thanks for taking the time to answer my question. I'm generating a PDF document using iText in Java. I need to set the column headers of a table a different colour than the ones in the values columns. I have the color hexadecimal value from Photoshop. I'm using PdfPTable with chunks and paragraphs. how do I set them to a different colour, other than the ones predefined in the BaseColor enum? Thanks in advance! 回答1: You'll need to take your 8-bit hexadecimal color value and convert it to 8-bit

How to disable letter characters in UITextField?

荒凉一梦 提交于 2020-01-01 08:55:49
问题 In my application i need to allow users input only numbers. How can i allow UITextField to receive only numbers from user? 回答1: The characters in this examples are allowed, so if you dont want the user to use a character, exclude it from myCharSet . - (BOOL)textField:(UITextField *)theTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSCharacterSet *myCharSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"]; for (int i = 0; i <

Fetching Values from textField in a custom cell iPhone

 ̄綄美尐妖づ 提交于 2020-01-01 07:03:36
问题 I have a custom cell in a table View, see below. I have two textFields txt1 and txt2 in my custom cell, as seen below How can i access the values i enter in each of the text fields so that i can add the values in to seperate Arrays... the "Addset" button will increment the no of sections of the grouped table View there by incrementing the one more set. my table view code is as follows. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

Add a permanent Character to UITextField

徘徊边缘 提交于 2020-01-01 06:16:56
问题 Is there a way to permanently add a letter to a UITextField where the user cannot delete it? I want to add a single character and the user not be able to delete it but they can still add letters after. Cheers, p.s. This is for iOS 回答1: A UITextField has a delegate method called should change characters in range, this method basically ask, should i add or remove the next character? and from that you can dictate what you would like. Here is some example code. - (BOOL)textField:(UITextField *

Cursor visibility issue in ios7

那年仲夏 提交于 2020-01-01 04:04:06
问题 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