Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>**I use in my project &lt; and use and implement use in .h file** @protocol InputAlertViewDelegate -(void)handleEnteredValue:(NSString*)_value; -(void)handleCancellation; @end @interface InputAlertView : UIAlertView &lt;UIAlertViewDelegate&gt; { UITextField *textField; id&lt;InputAlertViewDelegate&gt; caller; } @property(nonatomic, retain) UITextField *textField; @property(nonatomic, retain) id&lt;InputAlertViewDelegate&gt; caller; -(NSString*) theText; -(void) prepare; -(void) makePassword; -(void) makeTelephone; +(InputAlertView*) inputAlertViewWithTitle:(NSString*)_title initialFieldText:(NSString*)_text caller:(id&lt;InputAlertViewDelegate&gt;)_caller; **use in .m file** +(InputAlertView*) inputAlertViewWithTitle:(NSString*)_title initialFieldText:(NSString*)_text caller:(id&lt;InputAlertViewDelegate&gt;)_caller { InputAlertView *_alert = [[[self alloc] initWithTitle:_title message:@"\n" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil] autorelease]; _alert.delegate = _alert; _alert.caller = _caller; [_alert prepare]; _alert.textField.text = _text; return _alert; } -(void)prepare { self.textField = [[[UITextField alloc] initWithFrame:CGRectMake(12.0, 45, 260.0, 30.0)] autorelease]; [textField setBackgroundColor:[UIColor clearColor]]; textField.borderStyle = UITextBorderStyleRoundedRect; textField.autocapitalizationType = UITextAutocapitalizationTypeWords; [self addSubview:textField]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0); [self setTransform:myTransform]; -(void) show{ [textField becomeFirstResponder]; [super show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if(buttonIndex == 1){ [self.caller handleCancellation]; } else{ [self.caller handleEnteredValue:[self theText]]; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload