开发者

Add UIButton Icon?

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

I would like to implement something as shown on the picture. It would bring up a pickerView when it's tapped and write the chosen value onto it.

U开发者_Go百科IButton or TableViewCell?


There are several ways to go about this and you will have to use the UITableViewCellStyleValue1 style of UITableViewCell to have a detailTextLabel

  1. You can set

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

    Now in the didSelectRowAtIndexPath , upon touch you can modally show a uipickerView.

  2. You can use cell.accessoryType = UITableViewAccessoryTypeDisclosureIndicator; and add a textField as a subview to the cell.contentView and set

    textField.placeholder = @"Pick a date & time";
    textField.inputView = myPickerView;
    


Create a button and put a label on it.Whenever picker value changed, change the text of label.


I thinks it's

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜