0

次のようなリストが必要です。


「私のタイトル」 . . . . . . . . . . . "10:20AM"
"作成者: meadlai"

"TitleString" . . . . . . . . . . . "09:33AM"
"Created-by: meadlai"

"TextLabel" . . . . . . . . . . . "11:59AM"
"detailTextLabel"

タイトル、作成者、時間の 3 つのフィールドがあります。Phone.appの「Recents-Calls」スタイル
とほとんど同じです。 またはMail.appの mailList。custom-UITableViewCell は必要ないと思います。 System-UITableViewCell でこのようなリストを作成できますか? 手がかりやコードはありますか?ありがとうございます。


4

5 に答える 5

1

UITableViewを参照

これがあなたのすべての問題を解決するのに役立つことを願っています....

于 2012-09-13T06:37:31.987 に答える
1
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

    }

    cell.textLabel.text = @"Some Name";
    cell.detailTextLabel.text = @"Some text underneath";

    return cell;
}

具体的には、このコード行により、phone.app のような TableViewCell を作成できます

   cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

   UITableViewCellStyleSubtitle
于 2012-09-13T06:33:48.320 に答える
1
        cell.textLabel.text = @"Victoria";
        cell.detailTextLabel.text = @"created-by:mead";
        UILabel* time = [[UILabel alloc]initWithFrame:CGRectMake(5,5,80,20)];
        time.text = @"05:59 PM";
        cell.accessoryView = time;

終わり。

于 2012-09-13T07:09:09.020 に答える
1

accessoryViewあなたが望むような「スタイル」がないので、おそらくセルの を変更してください。それでも、カスタム セル クラスを使用すると作業が簡単になる場合があります。

セルのさまざまなスタイルの列挙。

typedef enum {
   UITableViewCellStyleDefault,
   UITableViewCellStyleValue1,
   UITableViewCellStyleValue2,
   UITableViewCellStyleSubtitle
} UITableViewCellStyle;

セルが使用する標準アクセサリ コントロールのタイプ。

typedef enum {
   UITableViewCellAccessoryNone,
   UITableViewCellAccessoryDisclosureIndicator,
   UITableViewCellAccessoryDetailDisclosureButton,
   UITableViewCellAccessoryCheckmark
} UITableViewCellAccessoryType;
于 2012-09-13T07:17:05.967 に答える
0

を引き続き使用できる簡単な解決策を探している人は、TDBadgedCellDetailDisclosureButtonのようなライブラリを使用できます。これにより、セルの左側にバッジを配置できます。バッジを強調表示したくない場合は、それに応じて設定してください。badgeTextColorbadgeColor

于 2013-09-27T15:15:32.110 に答える