我知道很多人都问过同样的问题,我已经尝试了很多,我不知道我错过了什么,我仍然可以让它工作。
我有一个 9*9 的表格,我想显示和更改,因为 Iphone 屏幕的大小,我想一次显示一列。我想要的是按下左上角的按钮,UIPickerView 将弹出允许我选择要显示的列,然后重新加载 UITextFields。
谁能给我一个详细的答案?在这(几个月)中我还是比较新的。先感谢您。
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
CGRect pickerFrame = CGRectMake(0, 40, 0, 0);
UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;
[actionSheet addSubview:pickerView];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];
[closeButton release];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
上面是我找到的代码,它弹出好了,我在将数组添加到pickerview时遇到问题,谁能告诉我dismissActionSheet方法应该如何?谢谢你。