madjid / MMPickerView

An easy to use and customizable PickerView for your iOS app.
MIT License
237 stars 59 forks source link

trouble with @{selectedObject: key} #15

Closed niko1aus closed 10 years ago

niko1aus commented 10 years ago

I have trouble when use @{selectedObject: key}

   [MMPickerView showPickerViewInView:self.view 
                           withStrings:countArray
                           withOptions:@{selectedObject: someSmokedPerDay1}
                            completion:^(NSString *selectedString) {
                                cell.value.text = selectedString;
                                [userDefaults setObject:cell.value.text forKey:@"someSmokedPerDay"];]

Xcode write error: 2014-04-24 18 18 32

I want to select row. How i can do this?

niko1aus commented 10 years ago

Sorry, my mistake. Right way for this task

NSDictionary *options = @{
                              MMfont: [UIFont fontWithName:@"VDS" size:18.0],
                              MMselectedObject: cigarettesInPack1
                              };

    [MMPickerView showPickerViewInView:self.view
                           withStrings:countArray
                           withOptions:options
                            completion:^(NSString *selectedString) {
                                //selectedString is the return value which you can use as you wish
                                cell.value.text = selectedString;
                                [userDefaults setObject:cell.value.text forKey:@"cigarettesInPack"] ;
                            }];