0
我想知道如何在整個班級中訪問NSString。說我有這些代碼:在整個班級中訪問NSString
- (void) init {
NSArray *elements = [xpathParser search:@"//foo"];
TFHppleElement *element = [elements objectAtIndex:0];
NSString *data = [element content];
NSArray *elements1 = [xpathParser search:@"//foo2"];
TFHppleElement *element2 = [elements1 objectAtIndex:0];
NSString *data2 = [element2 content];
}
而且我想用數據& DATA2在全班同學,我該怎麼辦呢?
我想在這裏顯示的結果:
- (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];
}
// Configure the cell.
switch (indexPath.row) {
case 0 :
cell.textLabel.text = (@"%@", data);
break;
case 1:
cell.textLabel.text = (@"%@", data2);
break;
}
// Email & Password Section
return cell;
}
你想他們只是提供了類,或者所有實例的該實例裏面? – Khanzor 2011-01-06 03:09:36
所有實例。 :) – 2011-01-06 03:37:58
`cell.textLabel.text =(@「%@」,data2);`是無稽之談。 – bbum 2011-01-06 05:32:28