objective c - remove object from NSMutableArray -


मेरे पास दो तत्व हैं:

  NSMutableArray * mruItems; NSArray * mruSearchItems;   

मैं एक UITableView कि mruSearchItems धारण मूल रूप से, और एक बार उपयोगकर्ता स्वाइप और एक विशिष्ट पंक्ति को हटा देता है, मैं खोजने की जरूरत है । mruItems अंदर कि स्ट्रिंग के सभी मैचों और उन्हें वहाँ से हटा दें

मैं NSMutableArray पर्याप्त उपयोग नहीं किया है और मेरे कोड मुझे किसी कारण से त्रुटियों देता है: < पूर्व> - (शून्य) तालिका दृश्य: (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) संपादन शैली के लिए RowAtIndexPath: (NSIndexPath *) indexPath {if (editingStyle == UITableViewCellEditingStyleDelete) {// यहाँ जोड़ें जब आप NSInteger i ; मैं = 0; (Self.mruItems में आईडी तत्व) {अगर के लिए ([(NSString *) तत्व isEqualToString: [self.mruSearchItems objectAtIndex: indexPath.row]]) {[self.mruItems removeObjectAtIndex: मैं]; } और {i ++; }} [Self.searchTableView पुनः लोडडेटा]; }

}

त्रुटि: मैं अब देखते हैं कि तार के कुछ उद्धरण चिह्नों के बीच नहीं हैं (UTF8 में लोगों को हालांकि रहे हैं)

  बिना किसी अपवाद के अपवाद को अस्वीकार करने के लिए ऐप को समाप्त करना 'एनएसजीनरिक एक्सपैशन', कारण: '*** संग्रह और लेफ्टिनेंट; __ एनएसएआरएमआरएम: 0x1a10e0 & gt; ("\ U05de \ U05e7 \ U05dc \ U05D3 \ U05ea", "\ U05de \ u05d7 \ U05e 9 \ U05d1 \ U05d5 \ U05df", "\ U05db \ U05d5 \ U05e0 \ U05df", "\ U05d1" , "\ U05d1", "\ U05d1", "\ U05d1", जैक, बीन्स, सिगरेट) '   

आप एक अपवाद है क्योंकि आप एक कंटेनर परिवर्तनशील कर रहे हैं उसके तत्वों से अधिक पुनरावृत्ति करते हुए मिल

<कोड> removeObject:। वास्तव में क्या आप देख रहे हैं करता है: को हटाने सभी वस्तुओं है कि तर्क के बराबर हैं

  - (शून्य) tableView:। (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath {if (संपादन शैली! = UITableViewCellEditingStyleDelete) वापसी; NSString * searchString = [स्व.मास्टर खोजआइटम वस्तुऑटएंडएक्स: इंडेक्सपाथ.रो]; [स्व.मात्र, हटाए गए ऑब्जेक्ट: खोज-स्ट्रिंग]; [Self.searchTableView पुनः लोडडेटा]; }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -