1

我在屏幕上返回了收款人列表,并想检查它们是否按字母顺序显示。它们以以下格式显示。我想检查它们是否按 ID 排序:“beneficiary_cell_title_label”

[BeneficiaryCellPhone] id: "beneficiary_cell"
[UITableViewCellContentView]
[UILabel] id: "beneficiary_cell_title_label",  label: "Aaa",  text: "Aaa"
[UILabel] id: "beneficiary_cell_number_label",  label: "111",  text: "111"
[UITableTextAccessibilityElement] id: "beneficiary_cell",  label: "Aaa, 111"
[BeneficiaryCellPhone] id: "beneficiary_cell"
[BeneficiaryCellPhone] id: "beneficiary_cell"
[UITableViewCellContentView]
[UILabel] id: "beneficiary_cell_title_label",  label: "Zzz",  text: "Zzz"
[UILabel] id: "beneficiary_cell_number_label",  label: "222",  text: "222"
[UITableTextAccessibilityElement] id: "beneficiary_cell",  label: "Zzz, 222"
[BeneficiaryCellPhone] id: "beneficiary_cell"
4

1 回答 1

1

使用以下代码解决了问题

/// <summary>
        /// Checks the alpha order.
        /// </summary>
        /// <returns><c>true</c>, if alpha order was checked, <c>false</c> otherwise.</returns>
        /// <param name="query">Query.</param>
        public bool CheckAlphaOrder(Func<AppQuery,AppQuery> query)
        {
            var list = app.Query(query);
            var orderByAsc = list.OrderBy(d => d.Text);
            if (list.SequenceEqual(orderByAsc))
            {
                return true;
            }else{
                return false;
            }
        }
于 2017-05-26T14:39:11.450 回答