Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. UIPickerView *picker = [[[UIPickerView alloc] init] retain];
  2. [picker sizeToFit];
  3. picker.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
  4. picker.delegate = self;
  5. picker.dataSource = self;
  6. picker.showsSelectionIndicator = YES;
  7.  
  8. - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
  9. if (component == 0) return [array1 count];
  10. if (component == 1) {
  11. NSLog(@"selectedRowInComponent:%i",[pickerView selectedRowInComponent:1]); //CRASHES HERE
  12. return [[array2 objectAtIndex:[pickerView selectedRowInComponent:1]] count];
  13. }
  14. }
  15.  
  16. *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement