0

在此处输入图像描述

我的 uinavigationbarcontroller 中的导航栏是隐藏的,但我的操作表认为它仍然存在,因此在操作页面的顶部给了我一个突出显示(见上图)。我怎样才能删除这个/欺骗我的操作表认为它是一个正常的 uiimageview?

在 didLoad 中隐藏的导航栏:

[self.navigationController setNavigationBarHidden:YES animated:NO];

和:

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    if (![self.navigationController isNavigationBarHidden])
    {
        [self.navigationController setNavigationBarHidden:YES animated:animated];
    }
}

在 didLoad 中的 actionsheet 如下所示:

actionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];

UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 200,320,16)];
[pickerToolbar sizeToFit];
    pickerToolbar.barStyle = UIBarStyleBlackTranslucent;

NSMutableArray *barItems = [[NSMutableArray alloc] init];

    UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonSystemItemCancel target:self action:@selector(cancel_clicked:)];
    [barItems addObject:cancelBtn];

    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    [barItems addObject:flexSpace];

UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(done_clicked:)];

    [barItems addObject:doneBtn];
    [pickerToolbar setItems:barItems animated:YES];
    [actionSheet addSubview:pickerToolbar];

UIPickerView *locationPicker = [[UIPickerView alloc] init];
locationPicker.frame = CGRectMake(0, 244, 320, 216);
locationPicker.delegate  = self;
locationPicker.dataSource = self;
locationPicker.showsSelectionIndicator = YES;
locationPicker.tag = 1;
[actionSheet addSubview:locationPicker];

然后它在文本字段触摸上动画。

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    if (textField == locationTextField.self)
    {
        [actionSheet showInView:self.view];
        [actionSheet setFrame:CGRectMake(0, 0, 320, 480)];
        [nameField resignFirstResponder];
    }
}
4

1 回答 1

1

我相信问题在于您选择显示操作表的视图。尝试在您的应用程序的主窗口中显示它。

于 2012-09-04T18:49:34.800 回答