image http://img809.imageshack.us/img809/8529/uibutton.png
我想实现图片所示的内容。它会在点击时调出一个pickerView并将所选值写入其中。
UIButton或TableViewCell?
答案 0 :(得分:4)
有几种方法可以解决此问题,您必须使用UITableViewCellStyleValue1
样式的UITableViewCell
来detailTextLabel
您可以设置
cell.detailTextLabel.text = @"Pick a date & time";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
现在在didSelectRowAtIndexPath
中,触摸后您可以模态显示uipickerView
。
您可以使用cell.accessoryType = UITableViewAccessoryTypeDisclosureIndicator;
并将textField作为子视图添加到cell.contentView
并设置
textField.placeholder = @"Pick a date & time";
textField.inputView = myPickerView;
答案 1 :(得分:0)
创建一个按钮并在其上添加标签。每当选择器值更改时,更改标签文本。
答案 2 :(得分:0)
我认为是
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {