मैं इस कोड का उपयोग मेरी UITableViewCells के विशिष्ट पंक्तियों पर एक 'ताला' आइकन प्रदर्शित करने के लिए कोशिश कर रहा हूँ:UITableView सेल accessoryView छवि मुद्दा
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TopicCell"];
GPBTopic *topic = [self.topics.list objectAtIndex:indexPath.row];
cell.textLabel.text= topic.name;
if ((indexPath.row == 5) || (indexPath.row == 9))
{
cell.accessoryView = [[ UIImageView alloc ] initWithImage:[UIImage imageNamed:@"lock_icon.png"]];;
[cell.accessoryView setFrame:CGRectMake(0, 0, 24, 24)];
}
return cell;
}
मैं एक अजीब परिणाम हो रही है - ताला शुरू में पंक्तियों 5 पर दिखाया जाता है , 9 लेकिन जब मैं नीचे स्क्रॉल करता हूं और सूची में आइकन को अन्य कोशिकाओं के एक्सेसरीव पर यादृच्छिक रूप से फिर से चलाया जाता है (वहां केवल 1 अनुभाग बीटीडब्लू) होता है, और स्क्रॉलिंग काफी झटकेदार और लगी हो जाती है ... जितना अधिक मैं ऊपर/नीचे स्क्रॉल करता हूं इसके अधिक उदाहरण प्रदर्शित होते हैं! क्यों? यहाँ बग कहाँ है?
सहायता, धन्यवाद!
क्योंकि सेल अन्य पंक्तियों के लिए पुन: उपयोग किया गया है जब आप स्क्रॉल, मुझे लगता है कि आप पंक्ति 5 और 9 –
के लिए एक अलग CellReuseIdentifier का उपयोग करना चाहिए मुझे लगता है कि कैसे करते हो? – mindbomb