Retrieving the UIImage of a TTPhotoViewController

I have a TTPhotoViewController subclass working nicely. I need to be able to give the option of saving the image downloaded to the user's saved photos directory. I am having problems actually retrieving a UIImage object.

After looking through the API I have seen that TTPhoto (which is one of the properties of the view controller) doesn't actually contain a UIImage to use. However, within the API there is a TTImageView class which has a UIImage property. TTPhotoView derives from TTImageView and there is one of these in my view controller class called "PhotoStatusView". However when I access this I do not get a UIImage back.

Any ideas?


Check this site out add save to album functionality

Here is the code from the site:

    _clickActionItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
     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];
        _toolbar.items = [NSArray arrayWithObjects:
                          space, _previousButton, space, _nextButton, space, nil, nil];
        [_innerView addSubview:_toolbar];


and this

   - (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);

You should try using:

UIImage *image = [[TTURLCache sharedCache] imageForURL:URL];

Need Your Help

How to read special characters like "ó" in Excel with TCL?

excel tcl ascii

There are some special characters in my .xls file. I am trying to read all lines in .xls and write them into .txt file, but characters are changed. For example: There are ós in the Excel.

Regex: filter html elements from a large string c#

c# regex

I am not good at regex and was trying to read some stuff but it is getting me nowhere.