添加UIButton图标?

时间:2011-08-06 04:43:01

标签: iphone xcode uibutton icons

image http://img809.imageshack.us/img809/8529/uibutton.png

我想实现图片所示的内容。它会在点击时调出一个pickerView并将所选值写入其中。

UIButton或TableViewCell?

3 个答案:

答案 0 :(得分:4)

有几种方法可以解决此问题,您必须使用UITableViewCellStyleValue1样式的UITableViewCelldetailTextLabel

  1. 您可以设置

    cell.detailTextLabel.text = @"Pick a date & time";
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    

    现在在didSelectRowAtIndexPath中,触摸后您可以模态显示uipickerView

  2. 您可以使用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 {