I have created a sample photo viewer using Three20 given at
How To Use the Three20 Photo Viewer | Ray Wenderlich and i have also created an app for image editing in which we can draw any shapes on image by moving pointer on the image. In Three20 there is a TTPhotoViewer class. It has following method
- (void)loadView {
CGRect screenFrame = [UIScreen mainScreen].bounds;
self.view = [[[UIView alloc] initWithFrame:screenFrame] autorelease];
CGRect innerFrame = CGRectMake(0, 0,
screenFrame.size.width, screenFrame.size.height);
_innerView = [[UIView alloc] initWithFrame:innerFrame];
_innerView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizing FlexibleHeight;
[self.view addSubview:_innerView];
_scrollView = [[TTScrollView alloc] initWithFrame:screenFrame];
_scrollView.delegate = self;
_scrollView.dataSource = self;
_scrollView.rotateEnabled = NO;
_scrollView.backgroundColor = [UIColor blackColor];
_scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizing FlexibleHeight;
[_innerView addSubview:_scrollView];
_nextButton =
[[UIBarButtonItem alloc] initWithImage:TTIMAGE(@"bundle://Three20.bundle/images/nextIcon.png")
style:UIBarButtonItemStylePlain
target:self
action:@selector(nextAction)];
_previousButton =
[[UIBarButtonItem alloc] initWithImage:
TTIMAGE(@"bundle://Three20.bundle/images/previousIcon.png")
style:UIBarButtonItemStylePlain
target:self
action:@selector(previousAction)];
UIBarButtonItem* playButton =
[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemP lay
target:self
action:@selector(playAction)]
autorelease];
playButton.tag = 1;
UIBarItem* space = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemFlexibleSpace target:nil action:nil] autorelease];
_toolbar = [[UIToolbar alloc] initWithFrame:
CGRectMake(0, screenFrame.size.height - TT_ROW_HEIGHT,
screenFrame.size.width, TT_ROW_HEIGHT)];
if (self.navigationBarStyle == UIBarStyleDefault) {
_toolbar.tintColor = TTSTYLEVAR(toolbarTintColor);
}
_toolbar.barStyle = self.navigationBarStyle;
_toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizing FlexibleTopMargin;
_toolbar.items = [NSArray arrayWithObjects:
space, _previousButton, space, _nextButton, space, nil];
[_innerView addSubview:_toolbar];
}
I implemented TTPhotoViewer protocol in my class and set the photoSource property of TTPhotoViewer in my my class. I am only supplying the photo source containing only photos of type TTPhoto to TTPhotoViewer protocol. Now i want to call my new custom class whenever i click on the photo. I have made a TTURLMap object in my Delegate.
[map from:@"tt://photo" toSharedViewController:[PhotoView class]];
Now i want to add a click event on photo that will request for the url tt://photo and execute my PhotoView class. Please note that i am only providing the PhotoSet object to TTPhotoViewController and rest of the work is done by Three20 TTPhotoViewController class.
How can we call our custom class when click on the image displayed in the photo album?