1

dateSheet我在获取用户人口统计信息的ActionSheet 中有一个 UIPickerview 。这是我的代码。

    UIPickerView *picker=[[UIPickerView alloc] initWithFrame:CGRectMake(0,125,320,216)];
    picker.tag = 1;
    picker.delegate=self;
    picker.showsSelectionIndicator=YES;
    [dateSheet addSubview:picker];
    [dateSheet showInView:self.view];
    [dateSheet setFrame:CGRectMake(0,220,320,312)];

我从这里更改了代码:

    UIPickerView *picker=[[UIPickerView alloc] initWithFrame:CGRectMake(0,95,320,216)];
    picker.tag = 1;
    picker.delegate=self;
    picker.showsSelectionIndicator=YES;
    [dateSheet addSubview:picker];
    [dateSheet showInView:self.view];
    [dateSheet setFrame:CGRectMake(0, 168, 320, 312)];

但无论哪种方式,现在在 iPad 模拟器上它看起来像这样

在此处输入图像描述 这是我设置我的pickerviews数据的地方

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
   return [pickerdata objectAtIndex:row];
}
4

0 回答 0