uitextfielddelegate

Trying to get index of active cell from textField inside custom cell of UITableView in iOS

假如想象 提交于 2019-12-12 18:24:52
问题 I have a UITableView in my application where I have custom UITableViewCell which contains a UITextField . What I would like to do is get the correct index of the row when I select a particular textfield from that row. Unfortunately, I am only able to get the correct index of the row if I actually click on the row, and not when I select the textfield itself. I am implementing the <UITextFieldDelegate> , and when I select a particular UITextField , I call the method: - (BOOL

iOS Swift Pass Closure as Property?

大憨熊 提交于 2019-12-12 07:09:33
问题 Let's say I have a custom UIView, lets call it MyCustomView. Inside this view is a UITextField property. Suppose my goal is to be able to create an instance of MyCustomView and add it to some view controller somewhere, and I want that view controller to be able to handle actions taken on that text field. For example, if I hit "return" on the keyboard within the text field, I may want to do some action - let me give an example of what I'm envisioning with some objective-c psuedo code:

detect where and what changes within textfield

杀马特。学长 韩版系。学妹 提交于 2019-12-12 04:56:52
问题 How can I check what exactly and where a string changed in my textfieldDidChange method? let str1 = "Hello how are you @Marie, nice day uh?" So imagine my user decides to edit the text and link markus instead of marie let str2 = "Hello how are you @ Markus, nice day uh?" I need a method that detect the change of @ Markus in the text field but doesn't change anything else in the string. I am able to detect last word, first word and so one, but its important to also see what changed within the

UIView automatically moving by uitextfield keyboard

北战南征 提交于 2019-12-12 03:25:16
问题 So i have a really weird problem at my hands and hours of search has provided nothing. I have a uiview containing a uitextfield. Now initially this view is outside of the visible screen with coordinates like x=-500,y=-500. However in response to a button press this view animates and moves into the center of the screen. Now whenever i tap on a uitextfield that is the subview of this view.This view moves back to its original coordinates outside the screen. I have frantically checked my code and

textFieldShouldReturn: is not called but textFieldDidEndEditing: gets called?

[亡魂溺海] 提交于 2019-12-12 03:07:00
问题 I have a textfield in a UIAlertController and I am trying to implement the delegate method textFieldShouldReturn: which doesn't get called. But i tried implementing the method textFieldDidEndEditing: which gets called without any problem. Please help me here. This is how i do it, __weak typeof(self) weakSelf = self; [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { textField.placeholder = @"Product upc"; textField.textAlignment = NSTextAlignmentCenter;

Error when ViewController is implementing UITextFieldDelegate

99封情书 提交于 2019-12-12 01:25:13
问题 When implementing the UITextFieldDelegate in my ViewController class, the following error is thrown when entering the first character in the text field: -[MyViewController respondsToSelector:]: message sent to deallocated instance... So, I tried creating a separate class (inheriting only NSObject) and implementing UITextFieldDelegate. Guess what, it worked perfectly. However, that introduces some other problems as I have to do a lot of ugly cross-class-communication that I'd like to avoid.

UITextField shouldChangeCharactersInRange Delegate not working

风流意气都作罢 提交于 2019-12-12 01:05:43
问题 I am having trouble with a new view I have created, I have a registration view that has a single UITextField on it and a UIButton. I call this view from another view like so //otherview.m - (void)viewDidLoad { [super viewDidLoad]; RegistrationAlertViewController *regreg = [[RegistrationAlertViewController alloc] init]; [self.view addSubview:regreg.view]; } Then I create my regregview like this //regregView.h #import <UIKit/UIKit.h> @interface RegistrationAlertViewController : UIViewController

Having trouble using NSNumberFormatter for currency conversion in iOS

好久不见. 提交于 2019-12-11 16:36:59
问题 I have a UITextField that receives numeric input from the user in my application. The values from this textfield then get converted into currency format using NSNumberFormatter within my shouldChangeCharactersInRange delegate method. When I enter the number "12345678", the number gets correctly converted to $123456.78 (the numbers are entered one digit at a time, and up to this point, everything works smoothly). However, when I enter another digit after this (e.g. 9), rather than displaying

How do I restrict UITextField to English only? (Stopping Chinese pinyin input)

若如初见. 提交于 2019-12-11 09:30:00
问题 I am building an app for release in Taiwan so it will be mostly in Chinese however the usernames must be English. I'm not sure how to stop Chinese characters from being input. So far I have restricted the length of the username to 12 characters and the characters must be in the set defined below: #define ACCEPTABLE_CHARACTERS @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" I implemented the - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange

how to move to next cell/row in table view with textview

大憨熊 提交于 2019-12-11 08:14:37
问题 i am stuck at this .please help me in sorting out this issue. this is my image now i have 5 different rows in the table. if u click on first textfield after editing the first field then i want done button click to goto the second field and open textview and textfield simulatneously(as shown in the image). The Category Filed is having picker view,The Name field (shown in image), Location is having same as image, price is having a action sheet. Now i have added code for action sheet of Price