1

私は iOS 開発の初心者で、同じ UITableViewCell にラベル (左側)、サブタイトル (右側)、およびスライダーを中央に配置する必要があります。今のところ、ラベルとサブタイトルはスライダーの上のセルにあります。それを行う方法はありますか?前もって感謝します。

4

1 に答える 1

0

はい、ストーリーボードを使用していますか?その場合は、セルのスタイルをカスタムに変更してから、他の要素をセルにドラッグして、必要な場所に配置します。

セル識別子名を必ず設定してください

後でcellForRowAtIndexPathでそれらに到達するようにタグ値を設定してください。

例:

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: "stateCell" forIndexPath:indexPath];

    UILabel * stateLabel =(UILabel *)[cell viewWithTag:1000];

    StateProvince * myState = [self.states objectAtIndex:indexPath.row];

    stateLabel.text = myState.label; }

于 2012-10-03T13:05:45.650 に答える