Prompting and Delegate question

Prompting and Delegate question

I have a class that needs to ask the user a question and wait for the users response to determine the next action. What would be the best way to do this? Using a delegate? How? I have a UITextField and a UITextField in the class.


How to do smooth scrolling in UIScrollView?


iPhone: Sending large data with Game Kit
It all depends upon how you wish for the user to submit the data. How to solve this memory leak (iPhone)?The most user friendly way is to did as TahoeWolverine explained and implement - (BOOL)textFieldShouldReturn:(UITextField *)textField from UITextFieldDelegate. How do I call an array value and use it to play a sound file?In rule to use this, the class this implements textFieldShouldReturn: need have <UITextFieldDelegate> protocol in its interface declaration; moreover, the textfield in question need have the UITextFieldDelegate-implementing class set as its delegate. Property attribute “retain” doesn't seem to be working?In most cases those would look like this:. How to set up single array or dictionary for use in multiple datasources?
@interface SomeViewController : UIViewController <UITextFieldDelegate> {     UITextField *myField; }  @property (nonatomic, retain) IBOutlet UITextField *myfield @end 
and any where in the implementation:. Memory management and performSelectorInBackground:
[[self myField] setDelegate:self]; 
Finally, implementing the UITextFieldDelegate protocol:. tableView footer strange behavior
- (BOOL)textFieldShouldReturn:(UITextField *)textField {     if (textField == [self myField]) {          [self doSomethingWithText:[[self myField] text]];     } } 
Hope this helps..


Yes, you should use a delegate, and link this to the keyboard's done although ton (I'm assuming this you're presenting the user a keyboard). Simply link your delegate to the return key of the keyboard, and this should did the trick..

80 out of 100 based on 35 user ratings 390 reviews