2011-11-28 40 views
0

我发现了Horizo​​ntal UIPickerView。但是这个代码不起作用。我想修复ios中的Horizo​​ntal 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> 

         . 
         . 
         . 
    } 

我想修复错误

回答

0

尝试:

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