0

「タップして入力してください..」というボタンがいくつかあります。それらをタップすると、テーブル ビューがポップアップしてオプションが表示されます。これらのオプションをボタンにリンクして、「タップして入力..」がユーザーが選択したデータ/行に置き換えられるようにするにはどうすればよいですか? どこから始めればよいかわかりません。よろしくお願いします。

4

2 に答える 2

0

これを試して:

- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
     NSUInteger row = [indexPath row];
     NSString *newText = [youArray objectAtIndex:row]; //yourArray contains your datas (of type NSString in this example)

     //consider your button btn is an inst var
     [btn setTitle:newText forState:UIControlStateNormal];
}
于 2013-05-13T15:08:37.473 に答える
0

// ボタンのクリック時にポップアップする viewcontroller.h ファイルに次のプロパティを作成します

@property (strong, nonatomic) UIButton  *button;

// 次のように、ボタンのクリック時にポップアップ ビューを呼び出します

YourTableViewController *tables = [UITableviewController alloc] init];
tables.button = buttonObjectWhoesTextYouWantToChange;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:tables];
popover.delegate = self;
popover.popoverContentSize=CGSizeMake(280.0, 327.0);

// ここで、tableviewcontroller の didSelectRowAtIndexPath メソッドにこの 1 行を追加します

self.button.text = cell.textLabel.text;
于 2013-05-13T16:03:15.257 に答える