Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed populating default text of BlockTextPromptAlertView #56

Merged
merged 1 commit into from Aug 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions BlockAlertsDemo/ToAddToYourProjects/BlockTextPromptAlertView.h 100644 → 100755
Expand Up @@ -18,6 +18,7 @@ typedef BOOL(^TextFieldReturnCallBack)(BlockTextPromptAlertView *);
NSCharacterSet *unacceptedInput; NSCharacterSet *unacceptedInput;
NSInteger maxLength; NSInteger maxLength;
NSInteger buttonIndexForReturn; NSInteger buttonIndexForReturn;
NSString* defaultText;
} }


@property (nonatomic, retain) UITextField *textField; @property (nonatomic, retain) UITextField *textField;
Expand Down
Expand Up @@ -59,6 +59,7 @@ - (void)addComponents:(CGRect)frame {
theTextField.autoresizingMask = UIViewAutoresizingFlexibleWidth; theTextField.autoresizingMask = UIViewAutoresizingFlexibleWidth;


theTextField.delegate = self; theTextField.delegate = self;
theTextField.text = defaultText;


self.textField = theTextField; self.textField = theTextField;
} }
Expand All @@ -71,13 +72,14 @@ - (void)addComponents:(CGRect)frame {


} }


- (id)initWithTitle:(NSString *)title message:(NSString *)message defaultText:(NSString*)defaultText { - (id)initWithTitle:(NSString *)title message:(NSString *)message defaultText:(NSString*)defaultTxt {


self = [super initWithTitle:title message:message]; self = [super initWithTitle:title message:message];


if (self) { if (self) {
maxLength = 0; maxLength = 0;
buttonIndexForReturn = 1; buttonIndexForReturn = 1;
defaultText = defaultTxt;


[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:) selector:@selector(keyboardWillShow:)
Expand All @@ -91,9 +93,9 @@ - (id)initWithTitle:(NSString *)title message:(NSString *)message defaultText:(N
return self; return self;
} }


- (id)initWithTitle:(NSString *)title message:(NSString *)message defaultText:(NSString*)defaultText block: (TextFieldReturnCallBack) block { - (id)initWithTitle:(NSString *)title message:(NSString *)message defaultText:(NSString*)defaultTxt block: (TextFieldReturnCallBack) block {


self = [self initWithTitle:title message:message defaultText:defaultText]; self = [self initWithTitle:title message:message defaultText:defaultTxt];


if (self) { if (self) {
self.callBack = block; self.callBack = block;
Expand Down