- (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];
}
Get current URL of UIWebView
NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location"];
touchesEnded example
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([touches count] == 1)
{
UITouch * touch = [touches anyObject];
if ([touch tapCount] == 1)
{
NSLog(@"Touch on");
CGPoint point = [touch locationInView:self.view];
UIImageView *view = nil;
NSArray *subviews = [scrollView1 subviews];
for (view in subviews)
{
if(CGRectContainsPoint(view.frame, point))
{
NSLog(@"gotchs");
}
}
}
}
}
{
if ([touches count] == 1)
{
UITouch * touch = [touches anyObject];
if ([touch tapCount] == 1)
{
NSLog(@"Touch on");
CGPoint point = [touch locationInView:self.view];
UIImageView *view = nil;
NSArray *subviews = [scrollView1 subviews];
for (view in subviews)
{
if(CGRectContainsPoint(view.frame, point))
{
NSLog(@"gotchs");
}
}
}
}
}
Subscribe to:
Posts (Atom)