I have created split view based ipad app, where master view is table view while Detail view display images.. I need to display the image fit to screen 100% in landscape mode
You can accomplish what you want by using a secondary window in your app that you display on-demand on top of your main window that contains the split view.
Create a new UIWindow & a new UIViewController. Add the UIViewController's view to your new window, set the window level to a positive value (1 or more) so that it is on top of your main window, then put the new window onscreen. If you set the window background color to [UIColor clearColor] and position your image in a view inside the new UIViewController directly on top of the image that is in the detail view then the user won't notice that anything new has happened. You can then animate the image frame up to fullscreen or do whatever you want. We sometimes use this technique to support drag & drop or our own custom modal view controllers but it'll work for your purpose too.
Here's an example:
@interface MyViewController : UIViewController @end
@interface AppDelegate : NSObject <UIApplicationDelegate> {
MyViewController *overlayController;
UIWindow *overlayWindow;
UIWindow *window; // the main window that contains your splitview
UINavigationController *navigationController; // or split view contoller, whatever, your main controller
}
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
@implementation MyViewController
- (void) loadView {
self.view = [[[UIView alloc] initWithFrame: CGRectZero] autorelease];
self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.view.backgroundColor = [UIColor redColor];
}
@end
@implementation AppDelegate
@synthesize window, navigationController;
- (void) click:(id) sender {
[overlayController.view removeFromSuperview];
[overlayController release];
overlayController = nil;
overlayWindow.hidden = YES;
[overlayWindow release];
overlayWindow = nil;
}
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Add the navigation controller's view to the window and display.
// standard stuff...
[self.window addSubview: navigationController.view];
[self.window makeKeyAndVisible];
// add the overlay window
// note that both the overlay window and controller are retained until we dismiss
// the window, this is important!
overlayWindow = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].applicationFrame]; // or [UIScreen mainScreen].bounds, depending on what you want
overlayController = [MyViewController new];
overlayController.view.frame = overlayWindow.bounds;
UIButton *button = [UIButton buttonWithType: UIButtonTypeRoundedRect];
[button addTarget: self action: @selector(click:) forControlEvents: UIControlEventTouchUpInside];
[button setTitle: @"Done" forState: UIControlStateNormal];
button.frame = CGRectMake( 0, 0, 100, 50 );
button.center = overlayController.view.center;
[overlayController.view addSubview: button];
// the controller's view is the first and only view in the
// new window. this ensures you get rotation events. Add any subviews
// that will appear in the new window to overlayContoller.view
[overlayWindow addSubview: overlayController.view];
[overlayWindow setWindowLevel: 1];
[overlayWindow makeKeyAndVisible];
return YES;
}
- (void)dealloc {
[overlayController release];
[overlayWindow release];
[navigationController release];
[window release];
[super dealloc];
}
@end