Problem solved..!! I just changed the height of sub view. Inside viewDidLoad
method of MyViewController
I adjusted the size of view.
iOS 7: Change height of UIAlertView
-
04-07-2023 - |
Domanda
I've gone through several posts explaining how to change alert view height but none of worked for me. Here is the scenario:
I am inserting a custom view inside alert view like this:
MyViewController *myViewController = [self.storyboard instantiateViewControllerWithIdentifier: @"MyView"];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Submit", nil];
[alertView setValue: myViewController.view forKey:@"accessoryView"];
[alertView show];
After adding custom view (i.e. myViewController.view), the size of alert view increased unnecessarily. To set desired size to alert view, I implemented following method:
- (void)willPresentAlertView:(UIAlertView *)alertView
{
[alertView setFrame:CGRectMake(0, 0, 280, 300)];
}
Still there was no change in alert view height. Any ideas how can I do that? Please help
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow