Problem in CGRectMake for TAbleView in AlertView
-(void)textFieldDidEndEditing:(UITextField *)textField{
[textInfo resignFirstResponder];
[self.navigationController setNavigationBarHidden:NO animated:YES];
informationTableView *informationtableView = [[informationTableView alloc] initWithNibName:@"informationTableView"bundle:nil];
UIView* MyView = informationtableView.view;
MyView.frame = CGRectMake(12.0f, 35.0f, 260.0f, 56.0f);
[self.view addSubview:MyView];
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Choisir" message:@"this gets coveredthis gets coveredthis gets coveredthis gets coveredthis gets coveredth开发者_运维问答is gets coveredthis gets coveredthis gets coveredthis gets coveredthis gets coveredthis gets coveredthis gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[myAlertView addSubview:MyView];
[myAlertView show];
[myAlertView release];
}
The problem is that the TableView is not controled by the frame. I'd like to get the tableView inside the Alert. How can I achieve this?
You should do this:
UIView* MyView = [[UIView alloc] initWithFrame: CGRectMake(12.0f, 35.0f, 260.0f, 56.0f)];
MyView.clipToBound = YES; //this ensures that the subviews are clipped by the view's frame
[MyView addSubview:informationtableView.view];
[self.view addSubview:MyView];
A) I don't think the UIAlert is going to behave well with a tablView inside of it. You're asking for trouble. B) I think you want to use a UIActionSheet, which is designed to show the user an array of choices.
精彩评论