2012-04-30 2 views
0

plistのデータをMWPhotoBrowserサンプルアプリに取り込もうとしています。MWPhotoBrowser plistのデータを追加しますか?

どのようにすればいいですか?

UIViewController *converterController = nil; 
    NSMutableArray *photos = [[NSMutableArray alloc] init]; 

    converterController = [[MWPhotoBrowser alloc] initWithPhotos:photos]; 
    converterController.hidesBottomBarWhenPushed = YES; 

//here individual images can be added. However need to add images from a plist. 

    [photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image1" ofType:@"jpg"]]]; 
    [photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image2" ofType:@"jpg"]]]; 
    [photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image3" ofType:@"jpg"]]]; 
    [photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"image4" ofType:@"jpg"]]]; 


    if (converterController) { 
     [self.navigationController pushViewController:converterController animated:YES]; 

     [converterController release]; 

    } 
    [photos release]; 

上記のように個別にオブジェクトを追加できますが、plistでは実行できません。

誰でもアイデアを共有できますか?

おかげ

答えて

0

wはエル私はこれを得たが、それは仕事をdoesntの。

SString *path = [[NSBundle mainBundle] pathForResource: 
     @"ImageData" ofType:@"plist"]; 

    // Build the array from the plist 
    photos = [[NSMutableArray alloc] initWithContentsOfFile:path]; 

アプリをクラッシュします。 MWPhotoプロパティを使用する必要があります。

ヘルプ誰ですか? マイケル・ウォーターフォールがこれを調べたいと思うかもしれませんか?

編集:ここ

OKが作業コード(まあ、それは今のところうまく動作)

NSUInteger nimages = 0; 
    for (; ; nimages++) { 

     NSString *nameOfImage_ = @"imageSufix"; 

     NSString *imageName = [NSString stringWithFormat:@"%@%d.jpg", nameOfImage_, (nimages + 1)]; 
     //NSLog(@"Name is %@", imageName); log the names 

     image = [UIImage imageNamed:imageName]; 
     if (image == nil) { 
      break; 
     } 

    [photos addObject:[MWPhoto photoWithImage:image]]; 
です
関連する問題