search

Home  >  Q&A  >  body text

objective-c - I have defined a data model of dict type, so how do I find its sum?


Prompt this error

曾经蜡笔没有小新曾经蜡笔没有小新2827 days ago581

reply all(3)I'll reply

  • 某草草

    某草草2017-05-02 09:25:40

    Your mistake is that you called a count method. According to the name, it takes the quantity, but your question asked about summation. I don’t know what you want to do specifically. However, since ProductCategoryDataModel is customized by you, if its parent class does not have a count or sum method, you need to implement the corresponding method yourself before you can call it.

    reply
    0
  • 怪我咯

    怪我咯2017-05-02 09:25:40

    If you are counting the number of dictionaries,
    somedict.allKeys.count
    or
    somedict.allValues.count

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:25:40

    What class does

    model inherit from?
    In addition, you can implement the -count; method by yourself

    reply
    0
  • Cancelreply