UITableView sections are not ordered as expected

前端 未结 1 1470
醉酒成梦
醉酒成梦 2021-01-26 02:01

I am using a tableView with customised section titles. The core data objects are shown on a precise section depending on the value from a transient attribute called sectionIdent

1条回答
  •  失恋的感觉
    2021-01-26 03:04

    you sort only based on due Date and name so the category with the oldest entry comes first.

    the entries would have to be sorted based on your sectionIdentifier first

    NSSortDescriptor *sortDescriptor0 = [[NSSortDescriptor alloc]initWithKey:@"sectionIdentifier" ascending:YES];
    NSSortDescriptor *sortDescriptor1 = [[NSSortDescriptor alloc]initWithKey:@"todoDueDate" ascending:YES];
    NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc]initWithKey:@"todoName" ascending:YES];
    

    0 讨论(0)
提交回复
热议问题