2012-10-03 37 views
1

我是iOS開發的初學者,我必須在同一個UITableViewCell中放置一個標籤(左側),一個字幕(右側)和一個滑塊。 現在,標籤和副標題位於滑塊上方的單元格中。 有沒有辦法做到這一點? 在此先感謝。UITableViewCell旁邊的UISliderCell

+0

歡迎來到Stack Overflow!你可以添加一個截圖到你的問題,並描述預期與現有行爲?謝謝! – brainray

回答

0

是的,你正在使用StoryBoard?如果是這樣,請將單元格樣式更改爲自定義,然後將其他元素拖動到單元格中的位置。

確保您設置的小區標識名稱

可以確保您的標籤值後,以得到他們的的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; }

+0

有一個故事板,但由兩個表格視圖單元格組成(2個部分),故事板中沒有其他內容了:-(事實上,有一個帶slSliderValueChanged方法的類SliderCell,這裏是顯示兩個單元格的代碼第一表視圖: – Hetana

+0

殼體3: 細胞= [的tableView dequeueReusableCellWithIdentifier:@ 「SelectedMeetingCell」]; [cell.textLabel的setText:@ 「工作持續時間」]; [cell.detailTextLabel的setText:[用具StringFromDuration:Agenda.InitialDuration sliderCell =(SliderCell *)[[UIViewController alloc] initWithNibName:@「SliderCell」bundle:nil] .view; [sliderCell setDelegate:self]; [sliding];滑動單元格; – Hetana

+0

case 4: [滑動單元格] erCell.slider setValue:Agenda.InitialDuration.doubleValue]; return sliderCell; – Hetana