Iphone 按下按钮时弹出UIPickerview
当我按下按钮弹出Iphone 按下按钮时弹出UIPickerview,iphone,Iphone,当我按下按钮弹出UIPickerview时,此代码是否有问题。什么也没发生。为什么 -(void)pickerview:(id)sender { items =[[NSArray alloc]initWithObjects:@"Hindi",@"English",nil]; pickerView=[[UIPickerView alloc] initWithFrame:CGRectMake(10,100,150,150)]; pickerView.transform = CGAffineT
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];
}
有人能告诉我这个代码有什么问题吗。是的。。大问题
[self.view addSubview:pickerview];
不见了
另外,您是否确定按下的按钮正在调用此方法..它返回(
void
)。。如果连接到xib组件,它应该显示iAction
,非常感谢我如何添加灰色背景墙的背景墙。。我不明白。。在您的代码中使用此代码..pickerView.backgroundColor=[UIColor clearColor]代码>很好,我知道了。谢谢你的帮助。一旦选择了这个选项,你怎么辞职呢?