0

我有这个方法来创建一个操作表和 uipicker:

-(void)presentNewPicker{
    self.aac = [[UIActionSheet alloc] initWithTitle:@"What City?"
                                                     delegate:self
                                            cancelButtonTitle:nil
                                       destructiveButtonTitle:nil
                                            otherButtonTitles:@"OK", nil];


    self.pickrView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 44.0, 0.0, 0.0)];
    self.pickrView.showsSelectionIndicator = YES;
    self.pickrView.dataSource = self;
    self.pickrView.delegate = self;

    self.cityNames = [[NSArray alloc] initWithObjects: @"Phoenix", @"Tahoe", @"Nevada", @"Lime", @"Florida", nil];

    UIToolbar *pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    pickerDateToolbar.barStyle = UIBarStyleBlackOpaque;
    [pickerDateToolbar sizeToFit];

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

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

    UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissActionSheet:)];

    [barItems addObject:doneBtn];

    [pickerDateToolbar setItems:barItems animated:YES];

    [self.aac addSubview:pickerDateToolbar];


    [self.aac addSubview:self.pickrView];
    [self.aac showInView:self.view];
    [self.aac setBounds:CGRectMake(0,0,320, 464)];
}

出现的按钮显示为 DONE,但我想将其修改为Ready。我该如何做到这一点?

4

2 回答 2

1

我不知道您想做什么,但您可能有兴趣将 inputView 和 inputAccessoryView 用于您的 uiview 之一,以替换键盘。这将免费为您提供动画,以及放置工具栏的地方。一些可能有帮助的答案:https ://stackoverflow.com/a/6075062/220820
https://stackoverflow.com/a/8583703/220820

于 2013-08-07T22:55:43.110 回答
1

代替:

UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissActionSheet:)];

和:

UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Ready" style: UIBarButtonItemStyleBordered target:self action:@selector(dismissActionSheet:)];

您可能想要使用UIBarButtonItemStyleDone样式。

于 2013-08-07T22:48:23.047 回答