uitextfield

iPhone perform action when UITextField / UISearchBar's clear button is pressed

不羁岁月 提交于 2019-12-13 12:23:45
问题 Is it possible to gain access to a delegate method that will allow additional actions to be performed when the "clear" button is pressed on a UITextField / UISearchBar? Thanks 回答1: See: UITextFieldDelegate Protocol Reference If you set your view controller as the delegate for your text field (can be done in interface builder), you can use: - (void)clearSearchTextField { ... } - (BOOL)textFieldShouldClear:(UITextField *)textField { if (textField == self.searchTextField) [self

textfield backspace action identify when textfield is empty?

梦想的初衷 提交于 2019-12-13 12:17:34
问题 I am trying to create otp textfield using five textfield.All working fine if you add top, but issue is occurred when user try to add textfield empty and trying to backspace and it was not call any delegate method of UItextfiled which I already added. I tried this :- func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool { let char = string.cStringUsingEncoding(NSUTF8StringEncoding)! let isBackSpace = strcmp(char, "\\b")

IQKeyboardManager navigation from UITextField to UITextView

十年热恋 提交于 2019-12-13 12:16:54
问题 IQKeyboardManager provides arrows in a toolbar just above my keyboard to jump from one UITextField to another but I am looking if I can jump between a mixture of UITextFields and UITextViews . I know the normal procedure to accomplish this task but I am interested to know if this is possible through IQKeyboardManager . Link to IQKeyboardManager 回答1: If I have my textview below in layers to the textfield but at the bottom in the xib then this problem arises. Check the following: . I drag

How Can I access the textfields in static TableViewcells without creating referencing outlet?

て烟熏妆下的殇ゞ 提交于 2019-12-13 09:39:57
问题 I have lot of text fields statically placed in static TableViewcells. How can access the text in it without creating referencing outlet for each textfield? I have tried taking subviews of cell. It's not working. Any alternatives? I tried this. It's not working. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; for (UIView *subview in [cell subviews]){ if(

I didn't get correct time when using time formatter

我只是一个虾纸丫 提交于 2019-12-13 09:05:23
问题 When i tried to get date and time from two textfields, i got incorrect time. my input date.text = may 20 2000 time.text = 02:00 AM but i got the time in nslog is :00:00:00 NSString *datestring = self.date.text; NSString *timestring = self.time.text; NSString *combined = [NSString stringWithFormat:@"%@ %@", datestring, timestring]; NSLog(@"%@",combined); NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"MMMM dd yyyy HH:mm:ss"]; NSDate *dates =

Correcting user submitted URL in Xcode/Objective C

天涯浪子 提交于 2019-12-13 08:58:31
问题 I'm trying to programme a mini browser in Xcode however at the moment the UIWebView will only load URLs that include the http ://www The user submits their URL using a UITextField and the contents become a string. I wondered if there was a way to either search the submitted string and add the http or www or both where required or format the text input so it automatically checks to see if the correct address is used. Thanks 回答1: Do something like this: NSString *urlString = ... // the user

UitextFiled with first letter must 0 and format will be like (0) 1234 56789 [duplicate]

帅比萌擦擦* 提交于 2019-12-13 08:44:59
问题 This question already has answers here : UiTextfield- First letter must be 0 (3 answers) Closed 7 months ago . I am using phone number texfield, now i am using this format for texfield (#) #### #####, now issue is that i want first character 0 as compulsary, like this (0) 1234 56789, so user enter whatever first character must be typed 0, its not duplicate quesion number format is different here is my code but its not working func textField(_ textField: UITextField, shouldChangeCharactersIn

I am looking for UITextFieldDelegate sample code [closed]

妖精的绣舞 提交于 2019-12-13 08:17:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am looking for UITextFieldDelegate sample code. Please teach when knowing. 回答1: Here's Apple's docs: UITextFieldDelegate In the first section, they have a bunch of links to sample code. See: Related sample code iPhoneCoreDataRecipes SimpleFTPSample SimpleURLConnections TaggedLocations UICatalog Unless you ask

Getting/Setting UITextField value in a table cell

牧云@^-^@ 提交于 2019-12-13 07:08:24
问题 For my current project i need to have a table in which contains textfield in each cell, the number of cells and textfield must be dynamic, it's depends on the number of data in a MutuableArray. I have the textfield in cells working, but i can't get/set the textfield value. I wonder if you guys can help me out or at least correct me what I did wrong? Thank's alot in advance. See code snippets below: // Adds textfield into cell - (UITableViewCell *)tableView:(UITableView *)tableView

How to Handle the UiTableviewCell textfields?

别等时光非礼了梦想. 提交于 2019-12-13 06:40:52
问题 i have custom tableview cell in custom cell i am taking the two textfield(First name,Age).My problem is how to handle the these textfields.if user not fill these these details we show the alert, per suppose user fill the details how to fetch the data. Bellow is my tableview custom cell image. 回答1: Add all textfields to NSMutableArray in cellForRowAtIndexPath -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ [mutableArrary addObject:cell