4
这段代码有什么问题,因为当我按下按钮弹出UIPickerview
。什么都没发生。这是为什么按下按钮时弹出UIPickerview
-(void)pickerview:(id)sender
{
items =[[NSArray alloc]initWithObjects:@"Hindi",@"English",nil];
pickerView=[[UIPickerView alloc] initWithFrame:CGRectMake(10,100,150,150)];
pickerView.transform = CGAffineTransformMakeScale(0.75f, 0.75f);
pickerView.delegate = self;
pickerView.dataSource = self;
pickerView.showsSelectionIndicator = YES;
pickerView.backgroundColor = [UIColor clearColor];
[pickerView selectRow:1 inComponent:0 animated:YES];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
{
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
{
return [items count];
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return[items objectAtIndex:row];
}
有人能告诉我什么是错的这个代码。
非常感谢我如何添加背景墙灰色 – user1120133 2012-03-05 20:00:38
背景墙? ..didn't不明白..在你的代码中玩这个代码..'pickerView.backgroundColor = [UIColor clearColor]; ' – Shubhank 2012-03-05 20:06:27
这很好,我明白了。谢谢你的帮助。 – user1120133 2012-03-05 20:07:46