ios - Count how many times a word appears in table view row -


in table view adding rows dynamically via button press.

the detailtextlabel.text varies depending on pass or fail result obtained in view

im trying figure out how best check how many rows contain word "fail"

i thought maybe add bool , count how many times flag raised? not sure how count how many times bool == yes?

 if(cell.textlabel.text && [cell.detailtextlabel.text rangeofstring:@"fail"].location != nsnotfound){           //count total amount of rows  detailtextlabel.text == failed, need count here?   } 

or can check rows self.circuits.count word fail perhaps?

well, opposed iterating on objects track ones contain "fail" , don't, why not check condition when add row. then, if contain "fail" can increment number (which can store ever want) , can keep track of total "fails".

self.somenumbertoremember ++ ; 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -