Como obtenho a largura do quadro do UIAlertController?
Gostaria de obter a largura do quadro UIAlertController para que eu possa especificar a largura de UIPickerView e UIToolbar que virá com o UIAlertController.
Eu tentei usar a seguinte instrução para obter a largura.
alertPicker.view.frame.size.width
Mas, a largura é igual à do viewController:
self.view.frame.size.width
Alguma idéia para obter a largura do UIAlertController? Muito obrigado.
Este é o meu código.
UIAlertController *alertPicker = [UIAlertController alertControllerWithTitle:nil message:@"\n\n\n\n\n\n\n\n\n\n\n\n" preferredStyle:UIAlertControllerStyleActionSheet];
CGRect pickerFrame = CGRectMake(8, 0, alertPicker.view.frame.size.width, self.view.frame.size.height/2);
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;
UIToolbar* pickerToolbar = [[UIToolbar alloc] initWithFrame: CGRectMake(2, 0, alertPicker.view.frame.size.width, 44)];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(doneBtnisClicked:)];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
pickerToolbar.items = [[NSArray alloc] initWithObjects:flexSpace,doneBtn,nil];
[alertPicker.view addSubview:pickerToolbar];
[alertPicker.view addSubview:pickerView];