You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by kfeagle <gi...@git.apache.org> on 2017/04/07 09:46:47 UTC

[GitHub] incubator-weex pull request #233: + [ios] picker support custom title title ...

GitHub user kfeagle opened a pull request:

    https://github.com/apache/incubator-weex/pull/233

    + [ios] picker support custom title title color background color and etc

    + [ios] picker support custom 
    
    title
    titleColor
    cancelTitle
    confirmTitle
    cancelTitleColor
    confirmTitleColor
    titleBackgroundColor
    height
    textColor
    selectionColor
    
    demo
    
    ```
    <template>
      <scroller>
        <wxc-panel title="picker module" type="primary">
          <text style="margin-bottom: 20px;">pick value: {{value}}</text>
          <wxc-button type="primary" onclick="{{pick}}" value="single pick" style="margin-bottom: 20px;"></wxc-button>
          <wxc-button type="primary" onclick="{{pickDate}}" value="pickDate" style="margin-bottom: 20px;"></wxc-button>
          <wxc-button type="primary" onclick="{{pickTime}}" value="pickTime"></wxc-button>
        </wxc-panel>
    
        <wxc-panel title="input component" type="primary">
          <text>onchange: {{txtChange}}</text>
          <input
                  type="date"
                  placeholder="select date"
                  class="input"
                  autofocus="false"
                  value=""
                  onchange="onchange"
                  max = "2029-11-28"
                  min = "2015-11-28"
          />
          <input
                  type="time"
                  placeholder="select time"
                  class="input"
                  autofocus="false"
                  value=""
                  onchange="onchange"
          />
        </wxc-panel>
      </scroller>
    </template>
    
    <style>
      .input {
        font-size: 60px;
        height: 80px;
        width: 400px;
      }
    </style>
    
    <script>
      require('weex-components');
      module.exports = {
        data: {
          value: '',
          index: 0,
          txtChange: ''
        },
        methods: {
          pick: function() {
            var picker = require('@weex-module/picker');
            var items = new Array("Saab","Volvo","BMW");
            var self = this;
            picker.pick({
              'items':items,
              'index':self.index,
              'title':'test',
              'titleColor':'blue',
              'cancelTitle':'cccc',
              'confirmTitle':'dddd',
              'cancelTitleColor':'black',
              'confirmTitleColor':'yellow',
              'titleBackgroundColor':'green',
              'height':600,
              'textColor':'red',
              'selectionColor':'gray'
            },function (ret) {
              var result = ret.result;
              if(result == 'success')
              {
                self.value = items[ret.data];
                self.index = ret.data;
              }
            });
    
          },
          pickDate: function() {
            var picker = require('@weex-module/picker');
            var self = this;
            picker.pickDate({
              'value':'2016-11-28',
              'max':'2029-11-28',
              'min':'2015-11-28'
            },function (ret) {
              var result = ret.result;
              if(result == 'success')
              {
                self.value = ret.data;
              }
            });
          },
          pickTime: function() {
            var picker = require('@weex-module/picker');
            var self = this;
            picker.pickTime({
              'value':'19:24'
            },function (ret) {
              var result = ret.result;
              if(result == 'success')
              {
                self.value = ret.data;
              }
            });
          },
          onchange: function(event) {
            this.txtChange = event.value;
            console.log('onchange', event.value);
          }
        }
      }
    </script>
    
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kfeagle/incubator-weex ios-feature-picker-0.12-dev

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-weex/pull/233.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #233
    
----
commit 151b3fdbe5d0e479a5baa17e6d56987588af673a
Author: \u9f50\u5c71 <su...@163.com>
Date:   2017-04-07T09:44:20Z

    + [ios] picker support custom title title color background color and etc

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-weex pull request #233: + [ios] picker support custom title title ...

Posted by bluebird78999 <gi...@git.apache.org>.
Github user bluebird78999 commented on a diff in the pull request:

    https://github.com/apache/incubator-weex/pull/233#discussion_r110566302
  
    --- Diff: ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m ---
    @@ -160,17 +201,52 @@ -(void)configPickerView
         [self.backgroundView addGestureRecognizer:tapGesture];
         self.pickerView = [self createPickerView];
         UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, WXPickerToolBarHeight)];
    -    [toolBar setBackgroundColor:[UIColor whiteColor]];
    +    toolBar.barTintColor = self.titleBackgroundColor?self.titleBackgroundColor:[UIColor whiteColor];
    +    
    +    
    +    
         UIBarButtonItem* noSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
         noSpace.width=10;
    -    UIBarButtonItem* doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
    -    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    -    UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
    +    
    +    UIBarButtonItem* doneBtn ;
    +    if (self.confirmTitle.length >0) {
    +        doneBtn = [[UIBarButtonItem alloc] initWithTitle:self.confirmTitle style:UIBarButtonItemStyleBordered target:self action:@selector(done:)];
    +    }else {
    +       doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
    +    }
    +    if(self.confirmTitleColor){
    +        doneBtn.tintColor = self.confirmTitleColor;
    --- End diff --
    
    confirmTitleColor is a text's color or a tintColor.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-weex pull request #233: + [ios] picker support custom title title ...

Posted by kfeagle <gi...@git.apache.org>.
Github user kfeagle commented on a diff in the pull request:

    https://github.com/apache/incubator-weex/pull/233#discussion_r110575097
  
    --- Diff: ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m ---
    @@ -160,17 +201,52 @@ -(void)configPickerView
         [self.backgroundView addGestureRecognizer:tapGesture];
         self.pickerView = [self createPickerView];
         UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, WXPickerToolBarHeight)];
    -    [toolBar setBackgroundColor:[UIColor whiteColor]];
    +    toolBar.barTintColor = self.titleBackgroundColor?self.titleBackgroundColor:[UIColor whiteColor];
    +    
    +    
    +    
         UIBarButtonItem* noSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
         noSpace.width=10;
    -    UIBarButtonItem* doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
    -    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    -    UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
    +    
    +    UIBarButtonItem* doneBtn ;
    +    if (self.confirmTitle.length >0) {
    +        doneBtn = [[UIBarButtonItem alloc] initWithTitle:self.confirmTitle style:UIBarButtonItemStyleBordered target:self action:@selector(done:)];
    +    }else {
    +       doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
    +    }
    +    if(self.confirmTitleColor){
    +        doneBtn.tintColor = self.confirmTitleColor;
    --- End diff --
    
    confirmTitleColor is a text's color


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-weex pull request #233: + [ios] picker support custom title title ...

Posted by bluebird78999 <gi...@git.apache.org>.
Github user bluebird78999 commented on a diff in the pull request:

    https://github.com/apache/incubator-weex/pull/233#discussion_r110566222
  
    --- Diff: ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m ---
    @@ -213,8 +293,38 @@ - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row f
     - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
     {
         self.index = row;
    +    if(self.selectionColor) {
    +        UILabel *labelSelected = (UILabel*)[pickerView viewForRow:row forComponent:component];
    +        [labelSelected setBackgroundColor:self.selectionColor?self.selectionColor:[UIColor whiteColor]];
    +    }
    --- End diff --
    
    what's the background color of labelSelected? when self.selectionColor is nil.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-weex pull request #233: + [ios] picker support custom title title ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-weex/pull/233


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---