A summary:
My AppDelegate has a UITabBarController of UINavigationControllers. When I click in corresponding tabBarItem display my imageGalleryViewController :
imageGalleryViewController:
Code:
-(void)loadView {
//Display my image gallery in a ScrollView
//Each image belongs to a press release
for (int i=0;i<[images count];i++) {
...
MyImageViewClass *img=[[MyImageViewClass alloc] initwithFrame:CGRect(...) ];
UIImage *image=[UIImage imageNamed:@"gray.png"];
[img setImage:image];
[scrollView addSubview:img];
....
}
}
My gallery has been displayed.
My UIImageViewClass:
-Each image belongs to a press release, so I would like to open a ViewController with their press release detail.
-I have to get the press release detail in an array. All images is ordered, Example, if I click in the first image, I searh the first index of the array and I get the press release detail.
-Now, I should open my detailViewController to display the press release detail.
Code:
-(id) initWithFrame: (CGRect) aFrame {
self=[super initWithFrame:aFrame];
if (!self) return NULL;
return self;
}
-(void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
UITouch *touch=[[event allTouches] anyObject];
int storyIndex=[touch view].tag;
NSString *storyLink=[[appDelegate.feedArray objectAtIndex:storyIndex] objectForKey:@"url"];
detailViewController *d=[[detailViewController alloc] initWithLink:storyLink];
[[self navigationController] pushViewController:d animated:YES];
}
My detailViewController:
Code:
-(id) initWithLink:link {
webView=[[UIWebView alloc] init];
NSString *urlAddress=link;
NSURL *url=[NSURL URLWithString:urlAddress];
NSURLRequest *requestObj=[NSURLRequest requestWithUrl:url];
[self.webView loadRequest:requestObj];
return self;
}
This is what I would like to do, but Ive read that ImageView has not NavigationController, by that dont works. I dont know if Ive explained good, so I dont know how i can to use the pushViewController