Question

This is my code... i've tried every path-format I can think of to get this to work... Basically I want to show an image in a quick and easy picture viewer... The viewer shows (modally... brilliant) but then the image dosen't show inside of that... I can't think why, the image definitely exists, and yet it just shows as a black screen.

thanks for any help. :)

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    QLPreviewController *preview = [[QLPreviewController alloc] init];
    [preview setDataSource:self];
    [self presentModalViewController:preview animated:YES];
}


#pragma mark QLPreviewController delegate methods

- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller {
    return 1;
}

- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index {

    NSString *imagePath = [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] bundleURL]];

    NSString *nextPath = [imagePath stringByAppendingPathComponent:imageName];

    NSURL *imageURL =  [NSURL URLWithString:nextPath];

    return imageURL;
}
Was it helpful?

Solution

NSURL *imageURL = [NSURL URLWithString:nextPath];

[NSURL fileURLWithPath:nextPath];

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top