I am creating textField in UIActionsheet, but I can't input text, can any one has idea about it ????
my coding is as follow
-(void)commentsMethod: (id) sender {
//setup UITextField for the UIActionSheet
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 28, 320, 150)];
//textField.delegate=self;
textField.autocorrectionType = UITextAutocorrectionTypeNo;
[textField setBackgroundColor:[UIColor clearColor]];
[textField setBorderStyle:UITextBorderStyleRoundedRect];
[textField becomeFirstResponder];
//CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)
UIButton *btn = [[UIButton alloc] init];
[btn setFrame:CGRectMake(0, 0, 100, 100)];
[btn setTitle:@"dismiss" forState:UIControlStateNormal];
[btn setBackgroundColor:[UIColor clearColor]];
[btn addTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
UIActionSheet *myActionSheet;
myActionSheet = [[UIActionSheet alloc] initWithTitle:@"Comments" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil, nil];
myActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[myActionSheet showInView:self.view];
myActionSheet.userInteractionEnabled=YES;
[myActionSheet setFrame:CGRectMake(0, 20, 320,600)];
[myActionSheet insertSubview:textField atIndex:0];
[myActionSheet insertSubview:btn atIndex:1];
//[self.myActionSheet dismissWithClickedButtonIndex:0 animated:NO];
//memory management
[textField release];
[myActionSheet release];
}
Only key window receives keyboard notifications, so you have to add your textField into the key window.
Hey Veer, There is a slightly different approach that you should be taking here. Here is what I propose.
.h file code
.m code
Use it and change the background color of the slideout. If you want I can give a codes that customize your UIButtons and create Custom colors for you to be used. Cheers