1

I am making a gallery using the Three20, my problem is when I try to create my view to show the gallery my AlbumController isn't populated with the photos get from my previous view. The Photos are there in a NSArray (inputAlbumController) and my title for the next view is in the NSTextField (txtSearch), the application enters the if-statement (self.albumView == nil), I tested them out with NSLog, but when I try to transfer them via the setters on the next view I get nothing. Here is some of the code needed for this problem:

This is the rootViewController.h:

@interface rootViewController : UIViewController {
    AlbumController *albumView;
    IBOutlet UITextField *txtSearch;
}
@property (nonatomic, retain) AlbumController *albumView;

This is in the function from my rootViewController.m:

geoFlickrAppDelegate *appDelegate = (geoFlickrAppDelegate *)[[UIApplication sharedApplication] delegate];
if(self.albumView == nil) {
    [albumView setMyImages:inputAlbumController];
    [albumView setMyTitle:txtSearch.text];
    //self.albumView = album;
    [appDelegate toGallery];
}

[self.navigationController pushViewController:self.albumView animated:YES];

This is my AlbumController.h:

@interface AlbumController : TTThumbsViewController {
    NSArray *myImages;
    NSString *myTitle;
}
@property (nonatomic, retain) NSArray *myImages;
@property (nonatomic, retain) NSString *myTitle;

This is the ViewDidLoad from my AlbumController.m:

- (void)viewDidLoad { 
self.photoSource = [[PhotoSource alloc]  
                    initWithType:PhotoSourceNormal  
                    title:myTitle  
                    photos:myImages  
                    photos2:nil  
                    ];  
} 

Any idea why is this so? Am I missing something?

Kex
  • 776
  • 10
  • 22
  • Where do you initialize the AlbumController controller? are you sure you're not forgetting that? – aporat Jul 07 '11 at 14:02
  • Well .. first I was creating a new AlbumController object & assigned that to the albumView object in the `if(self.albumView == nil)`, but now I removed it because I have `@syntesize albumView`in the rootViewController.m, but it's not working in both cases.. I'm pretty sure I'm not fogetting it, because the object exists & I get the thumbnail gallery view from it, but the objects doesn't have the images & the title.. – Kex Jul 07 '11 at 20:57

1 Answers1

1

It's hard to tell what's exactly the issue. For starters, you're not using the standard TTNavigator. It's not required, but it's easier to work with, especially when you use three20 TTViewControllers.

Secondly, AlbumController has to be initialized somewhere (preferable in the app launched function):

AlbumController* _albumContoller = [[AlbumController alloc] init];

I also recommend having the AlbumController object in the AppDelegate and not a part of another UIViewController. It will make things much easier:

[appDelegate.albumView setMyImages:inputAlbumController];
[self.navigationController pushViewController:appDelegate.albumView animated:YES];
aporat
  • 5,922
  • 5
  • 32
  • 54
  • I doing some major changes.. I'm trying to remove the navigationController & use TTNavigator. – Kex Jul 09 '11 at 08:46