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

Add custom view #62

Closed
guilhermearaujo opened this issue Feb 6, 2015 · 7 comments
Closed

Add custom view #62

guilhermearaujo opened this issue Feb 6, 2015 · 7 comments
Assignees

Comments

@guilhermearaujo
Copy link

I would like to be able to add a custom view to the alert, or at least a subclass of UITextField.
Perhaps a method like - (void)addTextField:(UITextField *)textField;

@dogo
Copy link
Owner

dogo commented Feb 6, 2015

addTextField its not enough?

You can customize laters using textField reference

SCLAlertView *alert = [[SCLAlertView alloc] init];

UITextField *textField = [alert addTextField:@"Enter your name"];

[alert addButton:@"Show Name" actionBlock:^(void) {
    NSLog(@"Text value: %@", textField.text);
}];

[alert showEdit:self title:@"Edit View" subTitle:@"This alert view shows a text box" closeButtonTitle:@"Done" duration:0.0f];

@guilhermearaujo
Copy link
Author

I am using a UITextField subclass that implements some input validation, and the only way to use to use it inside the alert is if I could add a previously created view. Since the method addTextField: automatically instantiates a regular UITextField, I can't replace it with the custom class I'm using. However, if I could pass a UITextField, I could pass the custom object.

@dogo
Copy link
Owner

dogo commented Feb 9, 2015

@guilhermearaujo Could you please test again, using commit f83a20b .
Let me you if works as aspected

@dogo dogo self-assigned this Feb 9, 2015
@guilhermearaujo
Copy link
Author

Great, it works!

@dogo dogo closed this as completed Feb 12, 2015
@dogo
Copy link
Owner

dogo commented Feb 13, 2015

Official release 0.5.4

@mzekrallah
Copy link

Thank you guys but I guess having a custom view is also necessary not only text fields .. in my case I wanted to add a radio buttons group so having only text fields is kind of limiting. Please reconsider this. Thanks

@dogo
Copy link
Owner

dogo commented Mar 4, 2016

Please @guilhermearaujo @mzekrallah update to 0.9.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants