tags:

views:

18

answers:

0

i am posting this again as i earlier results was in vain

now i have a table view --> section view i want section view to behave same as tableview like you can scroll forcefully and still data are consistent but in my section view they are sometime changing their place , as i cant go with static cell because i want the section view scrollable so how to avoid shuffling of data here is my code i am using IBoutlet tableview in section view also

- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //UILabel *labelb;
    UILabel *labela;
    UILabel *labelt;
    static NSString *CellIdentifier = @"Cell";



    UITableViewCell *cell = [tablevw dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
        //  
        //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle   reuseIdentifier:CellIdentifier] autorelease];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;


    switch(indexPath.section)
    {
            //(@"test");

            // cell.detailTextLabel.text
        case 0:

            NSLog(@"ff");


            CGRect frame;
            //frame.origin.x = 0; 
            frame.origin.x=35;
            frame.origin.y = 0;
            frame.size.height = 55;

            frame.size.width = 210;
            stateLabel = [[UILabel alloc] initWithFrame:frame];
            stateLabel.textColor = [UIColor blackColor];
            //stateLabel.textAlignment = UITextAlignmentCenter;
            //[label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:16]];
            [stateLabel setFont:[UIFont fontWithName:@"Georgia" size:16]];
            stateLabel.numberOfLines=4;
            stateLabel.tag = 77;
            [cell.contentView addSubview:stateLabel];
            [stateLabel release];
            stateLabel.text = [NSString stringWithFormat:@"%@", [jsonItem objectForKey:@"number"]];
stateLabel.backgroundColor = [UIColor clearColor];

            jsonLabel.text = [jsonItem objectForKey:@"number"];

            break;
        case 1:
            break;
        case 2:
            frame.origin.x = 85; 
            frame.origin.y = 120;
            frame.size.height = 25;
            frame.size.width = 280;
            tLabel = [[UILabel alloc] initWithFrame:frame];
            tLabel.textColor = [UIColor blackColor];
            //tLabel.textAlignment = UITextAlignmentCenter;
            //[label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:16]];
            [tLabel setFont:[UIFont fontWithName:@"Georgia" size:16]];
            tLabel.tag = 33;
            [cell.contentView addSubview:tLabel];
            [tLabel release];





            tLabel.text = [NSString stringWithFormat:@"%@",  [jsonItem objectForKey:@"home"]];
            tLabel.backgroundColor = [UIColor clearColor];
            break;


    }
    }

    return cell;
}