-2

I am receiving some strings in my SecondViewController. In this viewcontroller i have a tableView but not yet any tableCells.

I am receiving this information:

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

From this code

    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);

Does anyone know how to put this in a new cell with a the label from that cell "123456", with an image next to it, and the other information in a subviewcontroller?

I am willing to put a bounty on this question after 2 days

4

1 に答える 1

1

UITableViewDelegate http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.htmlを使用するだけです。

使用:

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView (テーブルビューに必要なセクションの数を返します)
  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section (特定のセクションに必要なセルの数を返す)

そしてもちろん:

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;
    }
于 2013-01-14T10:47:11.437 に答える