madjid / mmpickerview Goto Github PK
View Code? Open in Web Editor NEWAn easy to use and customizable PickerView for your iOS app.
License: MIT License
An easy to use and customizable PickerView for your iOS app.
License: MIT License
I think your picker's width don't use 320, eg.
ScreenW = [[UIScreen mainScreen] bounds].size.width,
_pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 44.0, ScreenW, 216.0)];
if I use iPhone6 or width more than 320,the pickerView will can't full my View
Thanks for great PickerView!
can you guide me, how to set its width = screen width on iPad?
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"];]
I want to select row. How i can do this?
How can I dismiss the PickerView when going back a segue programmatically?
pickerview didn't work on top of UITableView/UIScrollView if the view is scrolled down.
how to load new data array after selection of row of 1st data array. The new data array should appear in picker view based on selection of 1st data array.
Is it possible or know how to add an image to each row of the UIPickerView?
I'm attempting to use MMPickerView in a swift project. I've got my bridging header in place but the syntax required to use MMPickerView with with swift is escaping me.
Has anyone done this successfully?
This is my object class:
@class RKObjectMapping;
@interface MVCountryModel : NSObject
@property (strong, nonatomic) NSNumber *countryId;
@property (strong, nonatomic) NSString *countryName;
+ (RKObjectMapping *) responseMapping;
- (int) integerValue;
@end
First of all, i had to implement "integerValue" for displaying the picker in this way:
[MMPickerView showPickerViewInView:self.view
withObjects:_countries
withOptions:nil
objectToStringConverter:^NSString *(id object) {
return ((MVCountryModel *)object).countryName;
}
completion:^(id selectedObject) {
MVCountryModel *country = (MVCountryModel *)selectedObject;
[_labelCountry setText:country.countryName];
_selectedCountryId = country.countryId;
}];
But when a option where selected the app crash on my completion block because it only receive a NSString not an instance of my custom object class.
For make it work i had to change this method in this way:
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
if (self.objectToStringConverter == nil) {
/* self.onDismissCompletion ([_pickerViewArray objectAtIndex:row]); */
self.onDismissCompletion (self.objectToStringConverter ([self selectedObject]));
} else{
/* self.onDismissCompletion (self.objectToStringConverter ([self selectedObject])); */
self.onDismissCompletion ([_pickerViewArray objectAtIndex:row]);
}
}
It looks so simple that i think i'm doing something wrong, but don't! Hope it helps.
I don't have MMTextAlignment. I added it myself but it didn't come down with the CocoaPod.
When I select a row in MMPickerView
the completion
callback is executed. When I press Done
too.
Is there any way to execute completion
callback only when Done
is pressed and not when select a row?
Is there any possibility to add more than one component in the pickerview?
That would be perfect for all uses.
Thank you very much.
Please fix hard-coded width frame size
//PickerView Container with top bar
_pickerContainerView = [[UIView alloc] initWithFrame:CGRectMake(0.0, _pickerViewContainerView.bounds.size.height - 260.0, [[UIScreen mainScreen]bounds].size.width, 260.0)]; // before width was 320.0
I see a crash on selectedRow = [[_pickerViewArray objectAtIndex:0] integerValue];
but I don't understand why pickerView tries to take an integerValue from objects array that I pass via +(void)showPickerViewInView:(UIView *)view withObjects:(NSArray *)objects withOptions:(NSDictionary *)options objectToStringConverter:(NSString *(^)(id))converter completion:(void (^)(id))completion
The blue current selector image is not being displayed on iOS6, on iOS7 everything works
UIColor *colorbg = bgColor;
NSDictionary *options;
// iOS7
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
options = @{MMbackgroundColor: colorbg,
MMtextColor: [UIColor whiteColor],
MMtoolbarColor: [UIColor grayColor],
MMbuttonColor: [UIColor blackColor],
MMselectedObject: categoriaActual
};
// iOS6
} else {
options = @{MMbackgroundColor: colorbg,
MMtextColor: [UIColor blackColor],
MMtoolbarColor: [UIColor blackColor],
MMbuttonColor: [UIColor blackColor],
MMselectedObject: categoriaActual
};
}
[MMPickerView showPickerViewInView:self.view
withStrings:self.categorias
withOptions:options
completion:^(NSString *selectedString){
self.categoriaActual = selectedString;}
doneCompletionBlock:^{
//NSLog(@"doneCompletion");
[self actualizarCategoria:self.categoriaActual];
}];
I've noticed that memory usage continues to grow each time MMPickerView is activated. I noticed this on the app I am developing and in the example provided with the project.
Whenever I try to dismiss the picker the app crashes.
It seems the problem is in this line:
callBack([self selectedObject]);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.