2010-03-29 13 views
6

मेरे पास 8 ULESableViewController में बनाए गए 8 कक्ष हैं। मैं जानना चाहता हूं कि मैं चौथी और 8 वीं कोशिकाओं पर एक प्रकटीकरण सूचक कैसे दिखा सकता हूं। अभी मैंकुछ कोशिकाओं पर UITableViewCell एक्सेसरी प्रकार सेट करना, लेकिन सभी

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

में यह निर्माण कर रहा हूँ हालांकि मैं पूरी तरह से पता है कि यह हर कोशिका

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

उत्तर

18

बयान करता है, तो एक सरल का उपयोग करें:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    ... // do whatever 
    UITableViewCellAccessoryType accessoryType = UITableViewCellAccessoryNone; 
    if (indexPath.row == 3 || indexPath.row == 7) { 
     accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
    } 
    cell.accessoryType = accessoryType; 
    ... // do whatever 
} 
+0

@EthanB मैं देख रहा हूँ यह हो रहा अभी। – Morkrom

+0

@Morkrom मेरे पास इसे ठीक करने के लिए अब पर्याप्त प्रतिनिधि है। :) – EthanB

2

आप indexPath पता करने के लिए एक प्रकटीकरण सूचक जोड़ने जा रहा है, तो क्यों न सिर्फ सशर्त प्रकटीकरण लागू सूचक जब

if((indexPath.row == 3) || (indexPath.row == 7)) 

?

(indexPath.row है 0-आधारित पाठ्यक्रम के ... 4 3 है और 8 वीं 7. है और तुम वहाँ से बाहर भी जादू संख्या रखने के लिए #defines या किसी अन्य तरीके का उपयोग करना चाहिए।)

संबंधित मुद्दे