iPad UIActionSheet не отображается

Я использовал код из этого поста для отображения листа действий в моем приложении. Но он отображается как

enter image description here

В чем причина?

Мой код для отображения листа действий такой

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil 
                                                         delegate:nil
                                                cancelButtonTitle:nil
                                           destructiveButtonTitle:nil
                                                otherButtonTitles:nil];

[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];

CGRect pickerFrame = CGRectMake(0, 40, 300, 300);

UIView *pickerView = [[UIView alloc] initWithFrame:pickerFrame];
pickerView.backgroundColor=[UIColor blackColor];

[actionSheet addSubview:pickerView];


UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
closeButton.momentary = YES; 
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];


[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];

[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];

[self.view addSubview:actionSheet];

8
задан Community 23 May 2017 в 12:30
поделиться