开发者

two table view data management on iphone

开发者 https://www.devze.com 2023-01-20 05:40 出处:网络
i have 2 buttons A and B both display tableview and data initially same data but then in B there is a search button so when user serach tableViewB data changes and then if i press A

i have 2 buttons A and B both display tableview and data initially same data but then in B there is a search button so when user serach tableViewB data changes and then if i press A then i can see the data shown in B *my earlier data A is override by B* how to solve this issues so that i can see my old data in A

i did 1) different IB outlets name of tableview 2) changed the Cell Identifier name but no sucess kindly suggest

Table A code

- (UITableViewCell *)tableView:(UITableView *)tableView0 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //UITableView *tableView;
    UITableViewCell *cell;
    static NSString *Ce开发者_JAVA技巧llIdentifier = @"Cells";


    //self.tableView.frame = CGRectMake(0,searchBar.bounds.size.height,320,480);






    cell= [tableView0 dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil ) {


        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
        //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];


#pragma mark BG image for tableView


}

Table B code

- (UITableViewCell *)tableView:(UITableView *)tableview1 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //UITableView *tableView;
    UITableViewCell *cell;
    static NSString *CellIdentifier = @"Cell";


    //self.tableView.frame = CGRectMake(0,searchBar.bounds.size.height,320,480);



    NSLog(@" what is the valuE%d",[appDelegate.books count]);


    cell= [tableview1 dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil ) {



        NSLog(@" table view cell value %d",[appDelegate.books count]);
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    //  cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

Thanks


i finally fixed the issue... concept is i was parsing same xml and was using same array thats why value was same , now i made 2 different xml parser and 2 different array holding data separately and its fixed

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消