objective-ccocoa-touchiosthree20ttphotoviewcontroller

Add additional UIImage to TTPhotoViewController


I am using the Three20 framework to implement a photo viewer. However, I also intend to customize it by doing the following:
1) Add a profile photo on top of each photo displayed and add some text to it (I assume I have to add a subview)
2) Add additional buttons on the side of the photo to allow users to delete or star the photo.

I have looked into the code for TTPhotoViewController but am not sure the place where I can make all these customizations. Do I make the changes to a subclass of photo view? And where exactly in photo view can I do it?


Solution

  • First you have to subclass TTPhotoViewController (see the sample code in TTCatalog). Then make a subclass of TTPhotoView. In this subclass there are a lot of points, where you can add another Image or Label to the PhotoView. I just tested adding a new Label inside the

    - (void)showCaption:(NSString*)caption
    

    method and it worked great.

    The next step is to override the following method.

    - (TTPhotoView*)createPhotoView {
      return [[[TTPhotoView alloc] init] autorelease];
    }
    

    In this method you can just alloc, init and autrelease your own subclass of TTPhotoView. This way the photo shown in the TTPhotoViewController will be your own custom photo.

    I think my answer is a little bit confusing. If you need additional help, just post a comment.