1

I have a UIPickerview inside a ActionSheet dateSheet that gets the demographic of the user. Here is my code.

    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)];

I changed the code from this:

    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)];

But either way now on the iPad simulator it looks like this

enter image description here Here is where I set my pickerviews data

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
   return [pickerdata objectAtIndex:row];
}
BigT
  • 1,413
  • 5
  • 24
  • 52
  • Did you just forget to set `dataSource`? –  Jan 29 '13 at 14:36
  • I have the same thing for iPhone as I do iPad. I set items in titleForRow method. Does iPad need the dataSource when iPhone doesn't? The code is above – BigT Jan 29 '13 at 15:24
  • How do you "put" the data in this UIPickerView? – Larme Jan 29 '13 at 15:36
  • With the above code, I set what I have in `pickerdata` to the title of the pickerView row. Again this works for iPhone but for iPad it doesn't. I believe it has something to do with my frame. – BigT Jan 29 '13 at 16:14

0 Answers0