Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AlbumViewController.h
- @interface AlbumViewController : NIToolbarPhotoViewController <NIPhotoAlbumScrollViewDataSource>
- {
- NSMutableArray* photoInformation;
- }
- @end
- AlbumViewController.m
- //
- // AlbumViewController.m
- // NimbusPhoto
- //
- // Created by Zakir Hyder on 5/1/12.
- // Copyright (c) 2012 cybernetikz. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import <UIKit/UIKit.h>
- #import "AlbumViewController.h"
- @implementation AlbumViewController
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization
- }
- return self;
- }
- - (void)didReceiveMemoryWarning
- {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
- }
- #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];
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- - (NSInteger)numberOfPagesInPagingScrollView:(NIPhotoAlbumScrollView *)photoScrollView {
- return [photoInformation count];
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- - (UIImage *)photoAlbumScrollView: (NIPhotoAlbumScrollView *)photoAlbumScrollView
- photoAtIndex: (NSInteger)photoIndex
- photoSize: (NIPhotoScrollViewPhotoSize *)photoSize
- isLoading: (BOOL *)isLoading
- originalPhotoDimensions: (CGSize *)originalPhotoDimensions
- {
- NSDictionary* photo = [photoInformation objectAtIndex:photoIndex];
- NSLog(@"%@",[photo objectForKey:@"originalSource"]);
- UIImage* image = [UIImage imageNamed:[photo objectForKey:@"originalSource"]];
- return image;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- //- (id<NIPagingScrollViewPage>)pagingScrollView:(NIPagingScrollView *)pagingScrollView pageViewForIndex:(NSInteger)pageIndex
- - (id<NIPagingScrollViewPage>)pagingScrollView:(NIPagingScrollView *)pagingScrollView pageViewForIndex:(NSInteger)pageIndex {
- return [self.photoAlbumView pagingScrollView:pagingScrollView pageViewForIndex:pageIndex];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement