1
버튼을 클릭하면 UIPickerView를 만드는 방법을 명확하게 설명 할 수 있습니까? 제발 도와주세요 ... 고마워요! 이버튼을 클릭 한 후 UIPickerView를 만드는 방법은 무엇입니까?
-(IBAction)buttonPressed1:(id)sender{
CGSize pickerSize = [myLocationPickerView sizeThatFits:CGSizeZero];
myLocationPickerView.frame = CGRectMake(0.0,250,pickerSize.width,pickerSize.height);
[self.view addSubview:myLocationPickerView];}
- (void)viewDidLoad {
[super viewDidLoad];
arrayNo = [[NSMutableArray alloc] init];
[arrayNo addObject:@" example 1 "];
[arrayNo addObject:@" example 2 "];
[arrayNo addObject:@" example 3 "];
[arrayNo addObject:@" example 4 "];
[myLocationPickerView selectRow:0 inComponent:0 animated:NO];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)myLocationPickerView;
{
return 1;
}
- (void)myLocationPickerView:(UIPickerView *)myLocationPickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
{
mlabel.text= [arrayNo objectAtIndex:row];
}
- (NSInteger)myLocationPickerView:(UIPickerView *)myLocationPickerView numberOfRowsInComponent:(NSInteger)component;
{
return [arrayNo count];
}
- (NSString *)myLocationPickerView:(UIPickerView *)myLocationPickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
{
return [arrayNo objectAtIndex:row];
}