我在SecondViewController中收到一些字符串。 在这个viewcontroller中我有一个tableView但还没有tableCells。
我收到此信息:
2013-01-14 11:24:22.342 Scanner[16200:c07] (
123456,
"Jeans lynn skinny coj glass",
"119.90",
"S, M, L, XL",
"G-Star"
)
2013-01-14 11:24:22.342 Scanner[16200:c07] jsonstring:{"2":"G-Star","3":null,"product":"Jeans lynn skinny coj glass","4":"119.90","maten":"S, M, L, XL","5":"S, M, L, XL","barcode":"123456","afbeelding":null,"0":"123456","winkel":"G-Star","prijs":"119.90","1":"Jeans lynn skinny coj glass"}
2013-01-14 11:24:22.342 Scanner[16200:c07] barcode:123456
2013-01-14 11:24:22.343 Scanner[16200:c07] product:Jeans lynn skinny coj glass
2013-01-14 11:24:22.343 Scanner[16200:c07] prijs:119.90
2013-01-14 11:24:22.343 Scanner[16200:c07] maten:S, M, L, XL
2013-01-14 11:24:22.343 Scanner[16200:c07] winkel:G-Star
从此代码中
array = [[NSArray alloc] init];
array = a;
NSLog(@"%@", a);
string = [[NSString alloc] init];
string = s;
NSLog(@"jsonstring:%@", s);
NSString * barcode = [a objectAtIndex:0];
NSLog(@"barcode:%@", barcode);
NSString * product = [a objectAtIndex:1];
NSLog(@"product:%@", product);
NSString * prijs = [a objectAtIndex:2];
NSLog(@"prijs:%@", prijs);
NSString * maten = [a objectAtIndex:3];
NSLog(@"maten:%@", maten);
NSString * winkel = [a objectAtIndex:4];
NSLog(@"winkel:%@", winkel);
有没有人知道怎么把它放在一个新单元格中,该单元格带有来自该单元格“123456”的标签,旁边有一个图像,另一个信息位于子视图控制器中?
我愿意在2天后对这个问题给予赏金
答案 0 :(得分:1)
您只需使用UITableViewDelegate http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html。
使用:
当然:
tableView:cellForRowAtIndexPath:
示例:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [array count];
}
和你的手机:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
cell.text = @"lol";
return cell;
}