नहीं बुलाया गया मुझे पता है कि इस मुद्दे का पहले उल्लेख किया जा रहा है, लेकिन वहां पर प्रस्ताव लागू नहीं हुए। मेरे पास आईआईबी का उपयोग कर एक एम्बेडेड UITableViewController के साथ एक UINavigationController है। आईबी में UITableView के प्रतिनिधि और डेटा स्रोत दोनों UITableViewController के व्युत्पन्न पर सेट हैं। UITableViewController कक्षाओं के लिए XCode के टेम्पलेट का उपयोग करके यह कक्षा जोड़ा गया है। कोई कस्टम UITableViewCell नहीं है और तालिका दृश्य डिफ़ॉल्ट शीर्षक शैली का उपयोग एकल शीर्षक के साथ ही कर रहा है।आईफोन: didSelectRowAtIndexPath
ठीक है, सिम्युलेटर में सूची डेटा स्रोत द्वारा प्रदान किए गए दो तत्वों के साथ ठीक से प्रस्तुत की जाती है, इसलिए डेटा स्रोत ठीक से जुड़ा हुआ है। यदि मैं आईबी में डेटा स्रोत के लिए आउटलेट लिंक हटा देता हूं, तो इसके बजाय एक खाली तालिका प्रस्तुत की जाती है।
जैसे ही मैं इन दो वस्तुओं में से किसी एक पर टैप करता हूं, यह नीला चमक रहा है और में UITableView::_selectRowAtIndexPath
के दायरे में जीडीबी का सामना करना पड़ता है। यह मेरी गैर-खाली विधि में ब्रेकपॉइंट सेट तक नहीं पहुंच रहा है सिलेक्टरो इंडेक्सपैथ। मैंने विभिन्न चयनकर्ताओं के परिणामस्वरूप टाइपो को बाहर करने के लिए तर्क और विधि का नाम चेक किया।
मैं हाल ही में प्रतिनिधि ठीक से सेट कर दिया जाता है कि क्या में सफल नहीं हुआ है, लेकिन के रूप में यह डेटा स्रोत जो एक ही कक्षा से दो तत्वों हो रही है करने के लिए समतुल्य रूप सेट किया गया है, मैं उम्मीद यह ठीक से स्थापित किया जाना। तो क्या गलत हुआ?
मैं आईफोन/आईपैड एसडीके 3.1.2 चला रहा हूं ... लेकिन सिम्युलेटर में आईफोन एसडीके 3.1 के साथ भी कोशिश की।
संपादित करें:
#import "LocalBrowserListController.h"
#import "InstrumentDescriptor.h"
@implementation LocalBrowserListController
- (void)viewDidLoad {
[super viewDidLoad];
[self listLocalInstruments];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [entries count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
if (([entries count] > 0) && ([indexPath length] > 0))
cell.textLabel.text = [[[entries objectAtIndex:[indexPath indexAtPosition:[indexPath length] - 1]] label] retain];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (([entries count] > 0) && ([indexPath length] > 0))
{
...
}
}
- (void)dealloc {
[super dealloc];
}
- (void) listLocalInstruments {
NSMutableArray *result = [NSMutableArray arrayWithCapacity:10];
[result addObject:[InstrumentDescriptor descriptorOn:[[NSBundle mainBundle] pathForResource:@"example" ofType:@"idl"] withLabel:@"Default 1"]];
[result addObject:[InstrumentDescriptor descriptorOn:[[NSBundle mainBundle] pathForResource:@"example" ofType:@"xml"] withLabel:@"Default 2"]];
[entries release];
entries = [[NSArray alloc] initWithArray:result];
}
@end
संभावित डुप्लिकेट [प्रोग्रामव्यू पंक्ति प्रोग्रामेटिक रूप से चुनें] (http://stackoverflow.com/questions/2035061/select-tableview-row-programmatically) – jk2K