1

Mobile Safari のブックマーク ビューと非常によく似たリストを実装しようとしています。[編集] をクリックすると、次のようになります。

ここに画像の説明を入力

この画面から、項目を削除したり、その属性を変更したりできます (右側の DisclosureIndicator を使用)。Xamarin のチュートリアルに従いましたが、テーブルが編集モードのときに DisclosureIndicator を追加する方法が正確にわかりませんでした。ObjC または C# のいずれかでソリューションを使用します。

ここで簡単なものが欠けていますか?

4

2 に答える 2

1

iOS では、これは次の方法で行われます。

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES;
}

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleDelete;
}

- (void) setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing: editing animated: animated];
    [self.tableView setEditing:editing animated:animated];
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {


    if (editingStyle == UITableViewCellEditingStyleDelete) {
             //delete rows
    }
}

開示インジケータはセルアクセサリです。メソッドで設定できますcellForRowAtIndexPath

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

}
于 2012-09-04T18:57:37.063 に答える