(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *MyIdentifier = @"MyIdentifier";
ImageCell *cell = (ImageCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; // changed this

if(cell==nil)
{
cell = [[[ImageCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; // changed this

CGRect frame;
frame.size.width=270; frame.size.height=162; frame.origin.x=10; frame.origin.y=10;

NSDictionary *itemAtIndex = (NSDictionary *)[self.jsonArray objectAtIndex:indexPath.row];
NSString *myStringRaw = [NSString stringWithFormat:@"genratetemplates?id=%@",[itemAtIndex objectForKey:@"id"],nil];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:WWWROOT,myStringRaw,nil]];
NSLog(@"Template: %@",url);

UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
[webView setBackgroundColor:[UIColor blueColor]];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[cell.contentView addSubview:webView];
webView.delegate = self;
[webView autorelease];
[cell setData:itemAtIndex];
}

Post a Comment