<i id='iKQ7F'><tr id='iKQ7F'><dt id='iKQ7F'><q id='iKQ7F'><span id='iKQ7F'><b id='iKQ7F'><form id='iKQ7F'><ins id='iKQ7F'></ins><ul id='iKQ7F'></ul><sub id='iKQ7F'></sub></form><legend id='iKQ7F'></legend><bdo id='iKQ7F'><pre id='iKQ7F'><center id='iKQ7F'></center></pre></bdo></b><th id='iKQ7F'></th></span></q></dt></tr></i><div id='iKQ7F'><tfoot id='iKQ7F'></tfoot><dl id='iKQ7F'><fieldset id='iKQ7F'></fieldset></dl></div>

<legend id='iKQ7F'><style id='iKQ7F'><dir id='iKQ7F'><q id='iKQ7F'></q></dir></style></legend>
  • <tfoot id='iKQ7F'></tfoot>

      <small id='iKQ7F'></small><noframes id='iKQ7F'>

          <bdo id='iKQ7F'></bdo><ul id='iKQ7F'></ul>
      1. 多个 UIPickerViews

        时间:2024-04-14
          <tbody id='qqZEK'></tbody>
        <i id='qqZEK'><tr id='qqZEK'><dt id='qqZEK'><q id='qqZEK'><span id='qqZEK'><b id='qqZEK'><form id='qqZEK'><ins id='qqZEK'></ins><ul id='qqZEK'></ul><sub id='qqZEK'></sub></form><legend id='qqZEK'></legend><bdo id='qqZEK'><pre id='qqZEK'><center id='qqZEK'></center></pre></bdo></b><th id='qqZEK'></th></span></q></dt></tr></i><div id='qqZEK'><tfoot id='qqZEK'></tfoot><dl id='qqZEK'><fieldset id='qqZEK'></fieldset></dl></div>

        <legend id='qqZEK'><style id='qqZEK'><dir id='qqZEK'><q id='qqZEK'></q></dir></style></legend>
          <bdo id='qqZEK'></bdo><ul id='qqZEK'></ul>

          <tfoot id='qqZEK'></tfoot>

            <small id='qqZEK'></small><noframes id='qqZEK'>

                • 本文介绍了多个 UIPickerViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have a dilemma, I have two UIPickerViews which "show" when two distinct views load. I started with one UIPickerView and was able to get that up and running by loading the array and all the other UIPickerView actions within the ViewController.

                  I thought it would be as simple as copy/pasting the same methods for the new UIPickerView, but just changing the variable names, also within the same UIViewController.

                  Problem is - both UIPickerView are showing the same data set in the drop down ? Am I simply missing something obvious here?

                  Updated below

                  I did that for all four methods below and now that app crashes once the "next" view is loaded? Does this look right?

                  - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView 
                  
                  - (NSInteger)thePickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component
                  
                  - (NSString *)thePickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
                  
                  - (void)thePickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
                  

                  解决方案

                  Yeah you are, you have to use the UIPickerView argument to determine WHICH picker view is actually asking for data - since you have set both pickers to the same data source.

                  -(void)numberOfComponentInPickerView:(UIPickerView*)thePickerView {
                      if(thePickerView == firstPickerView) {
                         // return number of components in first picker    
                      } else if(thePickerView == secondPickerView) {    
                         // return number of components in second picker    
                      } else {
                         assert(NO);
                      }
                  }
                  
                  // repeat for all other delegate / datasource methods
                  

                  这篇关于多个 UIPickerViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从队列更新活动的最佳方式 下一篇:运行 android AVD 管理器时显示错误“未安装 HAX 内核模块!"

                  相关文章

                    • <bdo id='kxT2o'></bdo><ul id='kxT2o'></ul>
                  1. <tfoot id='kxT2o'></tfoot>
                    <i id='kxT2o'><tr id='kxT2o'><dt id='kxT2o'><q id='kxT2o'><span id='kxT2o'><b id='kxT2o'><form id='kxT2o'><ins id='kxT2o'></ins><ul id='kxT2o'></ul><sub id='kxT2o'></sub></form><legend id='kxT2o'></legend><bdo id='kxT2o'><pre id='kxT2o'><center id='kxT2o'></center></pre></bdo></b><th id='kxT2o'></th></span></q></dt></tr></i><div id='kxT2o'><tfoot id='kxT2o'></tfoot><dl id='kxT2o'><fieldset id='kxT2o'></fieldset></dl></div>

                      <legend id='kxT2o'><style id='kxT2o'><dir id='kxT2o'><q id='kxT2o'></q></dir></style></legend>

                      <small id='kxT2o'></small><noframes id='kxT2o'>