It was fairly easy to modify the three20 photoViewController for the uiActionList and saveToPhoto toolbar buttons.
In TTPhotoViewController modify these lines
_clickActionItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemAction
//TTIMAGE(@"UIBarButtonReply.png")
target:self action:@selector(clickActionItem)];
UIBarButtonItem* playButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemPlay 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)];
_toolbar.barStyle = self.navigationBarStyle;
_toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth
| UIViewAutoresizingFlexibleTopMargin;
NSString *searchCaption = @"Photo from networked";
NSRange range = [[_centerPhoto caption] rangeOfString:searchCaption];
if (range.location == NSNotFound) {
_toolbar.items = [NSArray arrayWithObjects:
space, _previousButton, space, _nextButton, space,_clickActionItem, nil];
[_innerView addSubview:_toolbar];
}else{
_toolbar.items = [NSArray arrayWithObjects:
space, _previousButton, space, _nextButton, space, nil, nil];
[_innerView addSubview:_toolbar];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { } - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex { if(6 == actionSheet.tag) { if(0 == buttonIndex)//save page { NSLog(@"photo: %@", [_centerPhoto URLForVersion:TTPhotoVersionLarge]); NSURL *aUrl = [NSURL URLWithString:[_centerPhoto URLForVersion:TTPhotoVersionLarge]]; NSData *data = [NSData dataWithContentsOfURL:aUrl]; UIImage *img = [[UIImage alloc] initWithData:data]; NSLog(@"photo:class %@", [img class]); UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
And add this towards the bottom
.
nice! Thanks for this!
-mikeD>
Posted by: mike | 12/14/2009 at 08:58 AM