it is a Single View Application, and I just add a button above it when I click the button, it will show the key board. and I can't auto release TSAlertView in onBtn function. Who can tell me why, I am really confused.
- (void)viewDidLoad
{
[super viewDidLoad];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(30, 30, 100., 50);
[btn setTitle:@"Test" forState:UIControlStateNormal];
[btn addTarget:self action:(@selector(onBtn:)) forControlEvents: UIControlEventTouchUpInside];
[btn setBackgroundColor:UIColor.greenColor];
[self.view addSubview:btn];
}
-(void)onBtn:(id)sender{
TSAlertView* av = [[TSAlertView alloc] init];
av.title = @"Test";
av.message = @"This is a test";
[av addButtonWithTitle:@"cancel"];
[av addButtonWithTitle:@"rename"];
av.style =TSAlertViewStyleInput;
av.buttonLayout = TSAlertViewButtonLayoutNormal;
av.usesMessageTextView =NO;
av.width = 0.0;
av.maxHeight = 0.0;
[av show];
}