我想修复 ios 中的 Horizo​​ntal UIPickerView 代码

发布于 2024-12-18 04:58:50 字数 969 浏览 2 评论 0原文

我找到了水平 UIPickerView 。但这段代码不起作用。

(//this:)是错误区域。

@property (retain, nonatomic)UIPickerView * myPickerView;
@property (retain, nonatomic) NSArray *pickerViewArray;

 #import "ViewController.h"

 @implementation ViewController

@synthesize myPickerView;
@synthesize pickerViewArray;

-(void)loadView{
// Write code to create self.view
// Then...
pickerViewArray = [[NSArray arrayWithObjects:
                    @"John Appleseed", @"Chris Armstrong", @"Serena Auroux",
                    @"Susan Bean", @"Luis Becerra", @"Kate Bell", @"Alain Briere",
                    nil] copy];
myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero]; //this:thread1 error
myPickerView.delegate = self;
     //this: Passing "ViewController 'const_strong'to parameter of incompatible      
    //type'id<UIPickerViewDelegate>   

                        .
                        .
                        . 
   } 

我想修复错误

I found Horizontal UIPickerView . but this code is not working .

(//this: )is error area.

@property (retain, nonatomic)UIPickerView * myPickerView;
@property (retain, nonatomic) NSArray *pickerViewArray;

 #import "ViewController.h"

 @implementation ViewController

@synthesize myPickerView;
@synthesize pickerViewArray;

-(void)loadView{
// Write code to create self.view
// Then...
pickerViewArray = [[NSArray arrayWithObjects:
                    @"John Appleseed", @"Chris Armstrong", @"Serena Auroux",
                    @"Susan Bean", @"Luis Becerra", @"Kate Bell", @"Alain Briere",
                    nil] copy];
myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero]; //this:thread1 error
myPickerView.delegate = self;
     //this: Passing "ViewController 'const_strong'to parameter of incompatible      
    //type'id<UIPickerViewDelegate>   

                        .
                        .
                        . 
   } 

I would like to fix error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨曦慕雪 2024-12-25 04:58:50

尝试:

self.myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,0,320, 215)];

Try:

self.myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,0,320, 215)];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文