Francois

unread,

Jun 16, 2009, 9:10:54 PM6/16/09

to Three20

Hi
I'm in the process of writing an app that makes use of photos from
Panoramio. I have successfully used TTPhotoViewController to allow me
to browse the photos that I have selected through Panoramio's API.
However, one of Panoramio's requirements is that I display proper
credit below the photo along with links back to their site and this is
the area that I'm having difficulty with. Perhaps if the label that
is displayed below each photo were a TTStyledTextLabel I would be able
to include links to panoramio in there? Any thoughts/suggestions on
how I might be able to achieve this?

Thanks,
Francois

klazuka

unread,

Jun 17, 2009, 2:05:41 AM6/17/09

to Three20

Here's some quick guidance:

The caption is managed by TTPhotoView
@interface TTPhotoView : TTImageView <TTImageViewDelegate> {
id <TTPhoto> _photo;
UIActivityIndicatorView* _statusSpinner;
UILabel* _statusLabel;
UILabel* _captionLabel;
TTPhotoVersion _photoVersion;
BOOL _extrasHidden;
BOOL _captionHidden;
}

The caption text is put into the caption label when the TTPhoto is
assigned to the TTPhotoView:
- (void)setPhoto:(id<TTPhoto>)photo {
if (!photo || photo != _photo) {
[_photo release];
_photo = [photo retain];
_photoVersion = TTPhotoVersionNone;

self.url = nil;

[self showCaption:photo.caption];
}

if (!_photo || _photo.photoSource.isLoading) {
[self showProgress:0];
} else {
[self showStatus:nil];
}
}

So go ahead and replace UILabel *_captionLabel with a
TTStyledTextLabel, and then augment the caption data provided by your
TTPhoto to include enough metadata that you can display both the
caption, plus the attribution and the link.

Make sure that you check throughout TTPhotoView to see how
_captionLabel is being used such that your replacement class can still
satisfy the same interface. I haven't looked into this, but it should
be pretty simple.

-keith

Francois

unread,

Jun 26, 2009, 11:08:09 PM6/26/09

to Three20

what I ended up doing is subclassing TTPhotoViewController and
overriding the following methods:

- (void)loadView;
- (void)updateDataView;

I left the original caption alone and added my own custom view above
the photo where I display attribution for the
panoramio photos. This custom view gets setup in loadView and gets
updated in updateDataView. I also added:

- (void)scrollViewWillRotate:(TTScrollView*)scrollView toOrientation:
(UIInterfaceOrientation)orientation

in order to hide my custom view when the phone is in landscape mode.

klazuka

unread,

Jun 27, 2009, 1:15:16 AM6/27/09

to Three20

Neat, thanks for sharing your solution.

-keith

Reply all

Reply to author

Forward