Q:

Server Based Communication in iOS sdk

Hello I'm using AMBubbleTableViewController which is available on GitHub,Everything is working fine but I could not get scrolled position up to last sent message.How to get last position of scroll.Any help Will be appreciated.Thanks

A:

You can use the TBXML to parse the response. You can get this from https://github.com/71squared/TBXML
**#import "NSDataAdditions.h"**
**#import "TBXML.h"**

 addArray=[[NSMutableArray alloc]init];

TBXML *tbxml=[TBXML tbxmlWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http: your url will be here"]]];

                TBXMLElement *rootXMLElement=tbxml.rootXMLElement;
                if (rootXMLElement) {
                    TBXMLElement *user=[TBXML childElementNamed:@"RootElement" parentElement:rootXMLElement];
                    while (user!=nil) {

                       TBXMLElement *Record = [TBXML childElementNamed:@"tag1" parentElement:user];
            if(record)
            { 

                        TBXMLElement *ico_img = [TBXML childElementNamed:@"ico_img" parentElement:user];
                        MutableDictionry=[NSDictionary dictionaryWithObjectsAndKeys:
                                          [TBXML textForElement:ico_img],@"ico_img",

                        user = [TBXML nextSiblingNamed:@"Table1" searchFromElement:user];
                        [addArray addObject:MutableDictionry];
                        }
                    }

In tableViewCell you can use SDWebImage library to show image. you can download the library from https://github.com/rs/SDWebImage
#import "UIImageView+WebCache.h"
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        NSString *CellIdentifier = [NSString stringWithFormat:@"Cell-%d",indexPath.row];
        UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        NSString *url= [[addArray objectAtIndex:indexPath.row]objectForKey:@"ico_img"];
        UserImageView =[[UIImageView alloc]initWithFrame:CGRectMake(5,0,70, 70) ];
        [UserImageView setImageWithURL:[NSURL url] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
    return cell;
    }

