daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top