1

NIPhotoAlbumScrollView http://jverkoey.github.com/nimbus/interface_n_i_photo_album_scroll_view.htmlを実装しようとしています。アプリバンドルで写真を使用しています。しかし、このコードは機能していません。ここに完全なコードのリンクがありますhttp://pastebin.com/ysvPL6ee

AlbumViewController.h

@interface AlbumViewController : NIToolbarPhotoViewController    <NIPhotoAlbumScrollViewDataSource>
{
    NSMutableArray* photoInformation;
}
@end


#import "AlbumViewController.h"

@implementation AlbumViewController

#pragma mark - View lifecycle

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
    photoInformation = [[NSMutableArray alloc] init];

    for(int i=0; i<2; i++)
    {
        NSString* originalImageSource = @"Photo001.jpg";
        NSString* thumbnailImageSource = @"img1.jpg";
        NSDictionary* prunedPhotoInfo = [NSDictionary dictionaryWithObjectsAndKeys:
                                            originalImageSource, @"originalSource",
                                            thumbnailImageSource, @"thumbnailSource",
                                            nil];
        [photoInformation addObject:prunedPhotoInfo];
    }

    self.photoAlbumView.dataSource = self;

    self.title = NSLocalizedString(@"Loading...", @"Navigation bar title - Loading a photo album");

    [self.navigationController setNavigationBarHidden:NO];

    [self.photoAlbumView reloadData];
}

編集

機能しない手段-画像をロードせず、ロード画像も表示しません

self.photoAlbumView.loadingImage = [UIImage imageWithContentsOfFile:
                                    NIPathForBundleResource(nil, @"img1.jpg")];

黒い画面しか表示されない

- (NSInteger)numberOfPagesInPagingScrollView:(NIPagingScrollView *)pagingScrollView またはその他のメソッドが呼び出されていません。

4

1 に答える 1

0

loadView メソッドの先頭に [super loadView] を追加するのを忘れていました。

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
    [super loadView];
    photoInformation = [[NSMutableArray alloc] init];

    for(int i=0; i<2; i++)
    {
        NSString* originalImageSource = @"Photo001.jpg";
        NSString* thumbnailImageSource = @"img1.jpg";
        NSDictionary* prunedPhotoInfo = [NSDictionary dictionaryWithObjectsAndKeys:
                                            originalImageSource, @"originalSource",
                                            thumbnailImageSource, @"thumbnailSource",
                                            nil];
        [photoInformation addObject:prunedPhotoInfo];
    }

    self.photoAlbumView.dataSource = self;

    self.title = NSLocalizedString(@"Loading...", @"Navigation bar title - Loading a photo album");

    [self.navigationController setNavigationBarHidden:NO];

    [self.photoAlbumView reloadData];
}
于 2012-05-04T10:26:26.907 に答える