I am new to iOS programming and have limited knowledge of iOS and Objective-C, so please give me some help.
I am working on a flickr photo app, which basically require photo data from flickr API and present one in scrollView.
But I meet some problem in my iPad version, presented with UISplitViewController. Let me give a simple intro of my app.
MASTER VIEW: a list of UITableViewController embedded in UINavigationViewController, basically it just use some Flickr API to get some data, present something like this:
navigationController - >
tableViewControllerA (photos organized by countries) - >
tableViewControllerB (photo list in that country) When photo is selected in TableViewControllerB, in my code I pass the photo URL (from flickr API) to my detail view controller which is a scrollView, and here is my code in scrollView's ViewController.
IBOutlet UIScrollView *scrollView;
IBOutlet UIImageView *imageView;
NSURL *photoURL;
- (void) viewDidLoad
{
[super viewDidLoad];
dispatch_queue_t downloadQueue = dispatch_queue_create("flickr donwloader", NULL);
dispatch_async(downloadQueue, ^{
// load image
self.imageView.image = [UIImage imageWithData: [NSData dataWithContentsOfURL:self.photoURL]];
dispatch_async(dispatch_get_main_queue(), ^{
// configure scrollView and imageView
CGSize photoSize = self.imageView.image.size;
self.scrollView.delegate = self;
[self.scrollView setZoomScale:1.00];
[self.scrollView setMinimumZoomScale:0.5];
[self.scrollView setMaximumZoomScale:1.00];
self.scrollView.contentSize = photoSize;
self.imageView.frame = CGRectMake(0, 0, photoSize.width, photoSize.height);
CGPoint scrollCenter = self.scrollView.center;
self.imageView.center = scrollCenter;
});
});
dispatch_release(downloadQueue);
and in master view when a picture is selected, I set the detailView (s