3

Is there a way to get a current image to an object of UIImage? I have tried casting TTPhoto to UIImage, but it doesn't work.

xpda
  • 15,585
  • 8
  • 51
  • 82
Saleh
  • 380
  • 3
  • 19

2 Answers2

2

I did this differently. My Photo source is generated using JSON data so I couldn't use the method above as the photo source is different every time. Instead I used the URLForVersion method on TTPhoto to download the image into a UIImage.

NSURL *imageURL = [NSURL URLWithString:[self.centerPhoto URLForVersion:TTPhotoVersionLarge]];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [UIImage imageWithData:imageData];
1

I figured it out. We can use TTPhotoViewController's instance variable centerImageIndex. This will give us the index of the current image.

Saleh
  • 380
  • 3
  • 19