Created
April 13, 2011 15:06
-
-
Save curt-labs/917695 to your computer and use it in GitHub Desktop.
with modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProductView *prodView = (ProductView *)self.view; //Reference to view | |
//create close button | |
UIBarButtonItem *closeButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closePopup)] autorelease]; | |
//image from the product | |
UIImageView *imageView = [[UIImageView alloc] initWithImage:[[prodView prodImage] backgroundImageForState:UIControlStateNormal]]; | |
imageView.contentMode = UIViewContentModeScaleAspectFit; | |
imageView.contentScaleFactor = .8; | |
//view Controller for image in popup | |
UIViewController *imageViewController = [[UIViewController new] autorelease]; | |
[imageViewController setTitle:[prodView.titleLabel text]]; //button title | |
imageViewController.navigationItem.leftBarButtonItem = closeButton; //add button to controller | |
imageViewController.contentSizeForViewInPopover = CGSizeMake(imageView.image.size.width, imageView.image.size.height); | |
//add image to view controller | |
[imageViewController.view addSubview:imageView]; | |
[imageView release]; | |
//create nav controller for button | |
UINavigationController *nc = [[[UINavigationController alloc] initWithRootViewController:imageViewController] autorelease]; | |
nc.modalInPopover = TRUE; | |
nc.modalPresentationStyle = UIModalPresentationFullScreen; | |
nc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; | |
[self presentModalViewController:nc animated:YES]; | |
/* | |
//create popup controller init with nav controller | |
popController = [[UIPopoverController alloc] initWithContentViewController:nc]; | |
//make visible or dismiss and release mem | |
if (![popController isPopoverVisible]) { | |
[popController presentPopoverFromRect:CGRectMake(0, 0, 0, 0) inView:self.view.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; | |
}else{ | |
[popController dismissPopoverAnimated:YES]; | |
[popController release]; | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment