Pregunta

Este es mi código ... he intentado todos los caminos de formato que puedo pensar para conseguir que esto funcione ... Básicamente quiero mostrar una imagen en un visor de imágenes rápido y fácil ... El visor muestra (modal ... genial) pero entonces la imagen muestran dosen't dentro de ese ... no se me ocurre por qué, sin duda existe la imagen, y sin embargo, sólo muestra como una pantalla en negro.

Gracias por cualquier ayuda. :)

// 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;
}
¿Fue útil?

Solución

NSURL * imageURL = [NSURL URLWithString: NextPath];

[NSURL fileURLWithPath: NextPath];

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top