Graphics Programs Reference
In-Depth Information
return;
// Make a rectangle that the frame of the button relative to
// our table view
CGRect rect = [[self view] convertRect:[sender bounds] fromView:sender];
// Create a new ImageViewController and set its image
ImageViewController *ivc = [[ImageViewController alloc] init];
[ivc setImage:img];
// Present a 600x600 popover from the rect
imagePopover = [[UIPopoverController alloc]
initWithContentViewController:ivc];
[imagePopover setDelegate:self];
[imagePopover setPopoverContentSize:CGSizeMake(600, 600)];
[imagePopover presentPopoverFromRect:rect
inView:[self view]
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
}
Finally, in ItemsViewController.m , get rid of the popover if the user taps any-
where outside of it .
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverCon-
troller
{
[imagePopover dismissPopoverAnimated:YES];
imagePopover = nil;
}
Build and run the application. Tap on the thumbnails in each row to see the full-size image
in the popover. Tap anywhere else to dismiss the popover.
Search WWH ::




Custom Search