Displaying Title on Coverflow Image Template for iphone
Question
I am using CoverFlow in my application ,it is working fine but, I need to display the title of image that appears to front in coverflow,To add images iam usinf following code...
loadImagesOperationQueue = [[NSOperationQueue alloc] init];
for (int i=0; i < 10; i++)
{
imageName = [[NSString alloc] initWithFormat:@"cover_%d.jpg", i];
[(AFOpenFlowView *)self.view setImage:[UIImage imageNamed:imageName] forIndex:i];
NSLog(@"my image name is %@",imageName);
NSLog(@"%d is the index",i);
}
[(AFOpenFlowView *)self.view setNumberOfImages:10];
Can any one help me out.Below is the screenshot I would like to implement.
Solution
yes.U have to pass like below:`
- (void)setImage:(UIImage *)image forIndex:(int)index named:(NSString*)imageName{
// Create a reflection for this image.
UIImage *imageWithReflection = [image addImageReflection:kReflectionFraction];
NSNumber *coverNumber = [NSNumber numberWithInt:index];
[coverImages setObject:imageWithReflection forKey:coverNumber];
[coverImageHeights setObject:[NSNumber numberWithFloat:image.size.height] forKey:coverNumber];
[coverImageName setObject:imageName forKey:coverNumber];`
// If this cover is onscreen, set its image and call layoutCover.
AFItemView *aCover = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:index]];
if (aCover) {
[aCover setImage:imageWithReflection originalImageHeight:image.size.height reflectionFraction:kReflectionFraction named:imageName];
[self layoutCover:aCover selectedCover:selectedCoverView.number animated:NO];
}
}`
and i pass the image name like below:
for (int i=0; i < 10; i++) {
imageName = [[NSString alloc] initWithFormat:@"cover_%d.jpg", i];UIImage* image_=[UIImage imageNamed:imageName];
CGFloat width = 290;
CGFloat height = 200;
CGSize newSize=CGSizeMake(width, height);
[(AFOpenFlowView *)self.view setImage:[self imageWithImage:image_ scaledToSize:newSize] forIndex:i named:imageName];
[imageName release];
NSLog(@"%d is the index",i);
}
[(AFOpenFlowView *)self.view setNumberOfImages:10];
OTHER TIPS
You simply take a label in method- (id)initWithFrame:(CGRect)frame{}
for class AFItemView.m in openflow code and check in the class:AFOpenFlowView.m in method - (void)centerOnSelectedCover:(BOOL)animated{}
set text as belowselectedCoverView.label.text=coverImagename;
.This worked for me.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow