LoginSignup
10
10

More than 5 years have passed since last update.

iOS7でセクションインデックスを設定すると編集モードの削除ボタンの表示が乱れる

Last updated at Posted at 2014-05-23

現象

セクションインデックスを指定して編集モードにして削除しようとすると下記画像のようにセクションインデックスの下に描画されてしまいます。

20140524-1_convert_20140524015323.png

いい解決策が見つからなかったのでとりあえず編集モード時はセクションインデックスを表示しないようにしました。
解決策が判明次第、記事を更新したいと思います。

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

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    if (self.editing) {
        return nil;
    }
    return @[@"あ", @"か", @"さ", @"た", @"な", @"は", @"ま", @"や", @"ら", @"わ"];
}

追記

セクションインデックスの背景色を透明にする方法もありますが、データがある行の罫線がセクションインデックスのある部分で表示されなくなってしまいます。

self.tableView.sectionIndexBackgroundColor = [UIColor clearColor];

20140524-2_convert_20140524234627.png

解決

追記の対応(セクションインデックスの背景色を透明にする)+
セル罫線のインデントをなくす事で正常に表示されるようになりました。やれやれです(^^;

[UITableViewCell appearance].separatorInset = UIEdgeInsetsZero;

2014-05-25-1_convert_20140525223910.png

10
10
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10