Question

Ceci est mon code ... j'ai essayé tous les chemins format que je peux penser à obtenir ce travail ... En fait, je veux montrer une image dans une visionneuse d'images rapide et facile ... Les spectacles des spectateurs (... génial modalement) mais l'image doesnt montrent l'intérieur de cette ... Je ne peux pas penser pourquoi, l'image existe bel et bien, et pourtant il montre juste comme un écran noir.

Merci pour toute aide. :)

// 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;
}
Était-ce utile?

La solution

  

NSURL * imageURL = [NSURL URLWithString: nextPath];

[NSURL fileURLWithPath: nextPath];

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top