<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

        Multiple UIPickerViews(多个 UIPickerViews)
          <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                  WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                  Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)
                  When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target(在 XCode 中为多个目标编译时,我如何确保某些文件不会包含在一个目标中)
                  Automatically copy property values from one object to another of a different type but the same protocol (Objective-C)(自动将属性值从一个对象复制到另一个类型不同但协议相同的对象 (Objective-C))
                  Selecting text in mobile Safari on iPhone(在 iPhone 上的移动 Safari 中选择文本)

                    • <bdo id='kxT2o'></bdo><ul id='kxT2o'></ul>
                            <tbody id='kxT2o'></tbody>
                          <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'>