Commit bc4c976f authored by xwenliang's avatar xwenliang

fix #85: iOS<9.0 cant set height of picker view

parent d199b354
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
@interface RCTBEEPickerManager() @interface RCTBEEPickerManager()
@property(nonatomic,strong)BzwPicker *pick; @property(nonatomic,strong)BzwPicker *pick;
@property(nonatomic,assign)float height;
@end @end
...@@ -79,7 +80,13 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){ ...@@ -79,7 +80,13 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
}]; }];
self.pick=[[BzwPicker alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 250) dic:dataDic leftStr:pickerCancelBtnText centerStr:pickerTitleText rightStr:pickerConfirmBtnText topbgColor:pickerToolBarBg bottombgColor:pickerBg leftbtnbgColor:pickerCancelBtnColor rightbtnbgColor:pickerConfirmBtnColor centerbtnColor:pickerTitleColor selectValueArry:selectArry weightArry:weightArry]; if ([[UIDevice currentDevice].systemVersion doubleValue] >= 9.0 ){
self.height=250;
}else{
self.height=220;
}
self.pick=[[BzwPicker alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.height) dic:dataDic leftStr:pickerCancelBtnText centerStr:pickerTitleText rightStr:pickerConfirmBtnText topbgColor:pickerToolBarBg bottombgColor:pickerBg leftbtnbgColor:pickerCancelBtnColor rightbtnbgColor:pickerConfirmBtnColor centerbtnColor:pickerTitleColor selectValueArry:selectArry weightArry:weightArry];
_pick.bolock=^(NSDictionary *backinfoArry){ _pick.bolock=^(NSDictionary *backinfoArry){
...@@ -95,7 +102,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){ ...@@ -95,7 +102,7 @@ RCT_EXPORT_METHOD(_init:(NSDictionary *)indic){
[UIView animateWithDuration:.3 animations:^{ [UIView animateWithDuration:.3 animations:^{
[_pick setFrame:CGRectMake(0, SCREEN_HEIGHT-250, SCREEN_WIDTH, 250)]; [_pick setFrame:CGRectMake(0, SCREEN_HEIGHT-self.height, SCREEN_WIDTH, self.height)];
}]; }];
...@@ -109,7 +116,7 @@ RCT_EXPORT_METHOD(show){ ...@@ -109,7 +116,7 @@ RCT_EXPORT_METHOD(show){
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:.3 animations:^{ [UIView animateWithDuration:.3 animations:^{
[_pick setFrame:CGRectMake(0, SCREEN_HEIGHT-250, SCREEN_WIDTH, 250)]; [_pick setFrame:CGRectMake(0, SCREEN_HEIGHT-self.height, SCREEN_WIDTH, self.height)];
}]; }];
}); });
...@@ -121,7 +128,7 @@ RCT_EXPORT_METHOD(hide){ ...@@ -121,7 +128,7 @@ RCT_EXPORT_METHOD(hide){
if (self.pick) { if (self.pick) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:.3 animations:^{ [UIView animateWithDuration:.3 animations:^{
[_pick setFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 250)]; [_pick setFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, self.height)];
}]; }];
}); });
}return; }return;
......
{ {
"name": "react-native-picker", "name": "react-native-picker",
"version": "4.0.8", "version": "4.0.9",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment