मैं ऑनलाइन सभी उदाहरणों के माध्यम से गया और यह पता नहीं लगा सका कि एनीमेशन के साथ टेबलव्यू में सेल को सही तरीके से कैसे जोड़ा जाए। आइए मान लें कि मेरे पास एक सेल वाला एक सेक्शन है और जब उपयोगकर्ता पहले सेल की एक्सेसरी पर क्लिक करता है तो मैं एक और सेल जोड़ना चाहता हूं।insertRowsAtIndexPaths का सही तरीके से उपयोग कैसे करें?
मेरे "जोड़ें" विधि से करता है:
- (IBAction) toggleEnabledTextForSwitch1onSomeLabel: (id) sender {
if (switch1.on) {
NSArray *appleComputers = [NSArray arrayWithObjects:@"WWWWW" ,@"XXXX", @"YYYY", @"ZZZZ", nil];
NSDictionary *appleComputersDict = [NSDictionary dictionaryWithObject:appleComputers forKey:@"Computers"];
[listOfItems replaceObjectAtIndex:0 withObject:appleComputersDict];
[tblSimpleTable reloadData];
}
है कौन सा काम कर रहा लेकिन कोई एनीमेशन है। मैं समझता हूं कि एनीमेशन जोड़ने के लिए, मुझे insertRowsAtIndexPaths का उपयोग करने की आवश्यकता है: RowAnimation के साथ, इसलिए मैंने कई विकल्पों को आजमाया लेकिन insertRowsAtIndexPaths को निष्पादित करते समय यह हमेशा क्रैश हो जाता है: RowAnimation विधि के साथ।
- (IBAction) toggleEnabledTextForSwitch1onSomeLabel: (id) sender {
if (switch1.on) {
NSIndexPath *path1 = [NSIndexPath indexPathForRow:1 inSection:0]; //ALSO TRIED WITH indexPathRow:0
NSArray *indexArray = [NSArray arrayWithObjects:path1,nil];
[tblSimpleTable insertRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationRight];
}
}
क्या मैं गलत कर रहा हूँ:
मेरी हाल की कोशिश ऐसा करने से था? मैं इसे आसानी से कैसे कर सकता हूं? मैं इस पूरे इंडेक्सपैथफोररो चीज को नहीं समझता ... मैं यह भी नहीं समझता कि इस विधि के साथ मैं नए सेल में एक लेबल नाम जोड़ सकता हूं। कृपया मदद करें ... धन्यवाद !!
क्या आपने 2 आइटम के साथ अपना डेटा स्रोत अपडेट किया था? –