Reputation: 380
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.
Upvotes: 3
Views: 227
Reputation:
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];
Upvotes: 2
Reputation: 380
I figured it out. We can use TTPhotoViewController's instance variable centerImageIndex. This will give us the index of the current image.
Upvotes: 1