Keeping popover in open state. Then, when I try to switch to 2/3 screen mode and change the position of center BarButtonItem with fixed space BarButtonItem in viewWillTrainsition, my popover tool-tip moves to the previous location of barButtonItem.
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
if (size.width>size.height) {
_fixedSpace.width = 280;
} else {
_fixedSpace.width = 80;
}
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
}];}
From iOS11, bar button item is using constraint instead of frames. So try giving a constraint to each bar button item. It might doesn't reflect visually but it plays a major role in producing this kind of issue.
Try using below code to set the constraint:
if #available(iOS 11.0, *)
{
_fixedSpace.widthAnchor.constraint(equalToConstant: 280.0).isActive = true
}
Hope this helps!
I replicated same scenario and I found a fix for this as below:
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
if (size.width > size.height) {
fixedSpace.width = 280;
} else {
fixedSpace.width = 80;
}
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
CGRect rect = [self.view convertRect:barBtn.frame fromView:barBtn];
popover.sourceRect = rect;
}];
Try to reset the sourceRect property in the completion block.
Hope this is helpful!
As far as I understood your question I want to propose a simple solution for this :
I have took a Viewcontroller and PopoverView in storyboard. Viewcontroller will work as main view controller where as PopoverView will work to display as popover.
(Caution : Don’t Forget to set Explicit Content Size for PopoverView in StoryBoard) for more reference you can see attached screen shot of my storyboard.
Here is sample source code of Viewcontroller in which you will find Popoverview position will change as per the right button frame change.
This code is developed using Objective C
ViewController.h
//
// ViewController.h
// SOPopoverControllerDemo
//
// Created by Test User on 08/01/18.
// Copyright © 2018 Test User All rights reserved.
//
#import <UIKit/UIKit.h>
#interface ViewController : UIViewController
#end
ViewController.m
//
// ViewController.m
// SOPopoverControllerDemo
//
// Created by Test User on 08/01/18.
// Copyright © 2018 Test User All rights reserved.
//
#import "ViewController.h"
#interface ViewController () <UIPopoverPresentationControllerDelegate>
#property (weak, nonatomic) IBOutlet UIBarButtonItem *leftToolBarBtn;
#property (weak, nonatomic) IBOutlet UIBarButtonItem *rightToolBarBtn;
#property (weak, nonatomic) IBOutlet UIBarButtonItem *flexibleBtn;
#property (weak, nonatomic) IBOutlet UIToolbar *bottomToolBar;
#property (weak,nonatomic) UIPopoverPresentationController *popOverController;
#end
#implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
if (self.view.frame.size.width > self.view.frame.size.height) {
self.rightToolBarBtn.width = 200;
self.leftToolBarBtn.width = 200;
} else {
self.rightToolBarBtn.width = 150;
self.leftToolBarBtn.width = 150;
}
}
- (void) viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
if (size.width > size.height) {
_rightToolBarBtn.width = 200;
[self dismissViewControllerAnimated:true completion:nil];
[self rightToolBarBtnTapped:_rightToolBarBtn];
} else {
_rightToolBarBtn.width = 150;
[self dismissViewControllerAnimated:true completion:nil];
[self rightToolBarBtnTapped:_rightToolBarBtn];
}
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
}];
}
- (IBAction)rightToolBarBtnTapped:(id)sender {
//Grab the controller for popover
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:#"PopoverView"];
if (self.view.frame.size.width > self.view.frame.size.height ) {
controller.preferredContentSize = CGSizeMake(200, 100);
} else {
controller.preferredContentSize = CGSizeMake(150, 100);
}
controller.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:controller animated:YES completion:nil];
// configure the Popover presentation controller
_popOverController = [controller popoverPresentationController];
_popOverController.delegate = self;
_popOverController.permittedArrowDirections = UIPopoverArrowDirectionUp;
_popOverController.barButtonItem = self.rightToolBarBtn;
}
//--------------------------------------------------
#pragma mark -> UIPopOverController Delegate
//--------------------------------------------------
- (BOOL)popoverPresentationControllerShouldDismissPopover:(UIPopoverPresentationController *)popoverPresentationController {
return YES;
}
- (void)popoverPresentationControllerDidDismissPopover:(UIPopoverPresentationController *)popoverPresentationController {
NSLog(#"Popover Did Dismissed");
}
#end
PopoverView.h
//
// PopoverView.h
// SOPopoverControllerDemo
//
// Created by Test User on 08/01/18.
// Copyright © 2018 Test User All rights reserved.
//
#import <UIKit/UIKit.h>
#interface PopoverView : UIViewController
#end
PopoverView.m
//
// PopoverView.m
// SOPopoverControllerDemo
//
// Created by Test User on 08/01/18.
// Copyright © 2018 Test User All rights reserved.
//
#import "PopoverView.h"
#interface PopoverView ()
#end
#implementation PopoverView
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
Related
// // PopupViewController.h // TheStore
// // Created by Daniel Habshush on 11.04.15. // Copyright (c) 2015
H Company. All rights reserved. //
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "AppDelegate.h"
#interface PopupViewController : UIViewController
#property (weak, nonatomic) IBOutlet UIView *popUpView;
- (void)showInView:(UIView *)aView animated:(BOOL)animated;
#end
// // PopupViewController.m // TheStore // // Created by Daniel
Habshush on 11.04.15. // Copyright (c) 2015 H Company. All rights
reserved. //
#import "PopupViewController.h"
#interface PopupViewController ()
#end
#implementation PopupViewController
- (void)viewDidLoad
{
self.view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.6];
self.popUpView.layer.cornerRadius = 5;
self.popUpView.layer.shadowOpacity = 0.8;
self.popUpView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
[super viewDidLoad];
}
- (void)showAnimate
{
self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
self.view.alpha = 0;
[UIView animateWithDuration:.25 animations:^{
self.view.alpha = 1;
self.view.transform = CGAffineTransformMakeScale(1, 1);
}
- (void)removeAnimate
{
[UIView animateWithDuration:.25 animations:^{
self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
self.view.alpha = 0.0;
} completion:^(BOOL finished) {
if (finished) {
[self.view removeFromSuperview];
}
}];
}
- (IBAction)closePopup:(id)sender {
[self removeAnimate];
}
- (void)showInView:(UIView *)aView animated:(BOOL)animated
{
[aView addSubview:self.view];
if (animated) {
[self showAnimate];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
#end
}
#end
So, my question is:
I want to add a PopupView Controller to main.storyboard but can't somehow solve the last error.
You're missing the closing curly brace in your showAnimate method, which gives you an error in the following method.
I'm learning how to implement custom view transition. I want to create a slide menu something like spotify side menu. I'm using UIViewControllerAnimatedTransitioning. The animation seems to be working but after dismissing transition, the screen become blank.
This is the code for presenting transition
#import "Transition.h"
#implementation Transition
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{
return 1;
}
-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{
UIViewController *to=[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController *from=[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIView *containerView=[transitionContext containerView];
to.view.alpha=0.0;
[containerView addSubview:to.view];
[containerView addSubview:from.view];
[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
from.view.frame = CGRectMake(200, 0, from.view.frame.size.width, from.view.frame.size.height);
from.view.alpha=1.0;
to.view.alpha=1.0;
} completion:^(BOOL finished) {
[transitionContext completeTransition:YES];
}];
}
#end
This is the code for dismissal transition
#import "DismissTransition.h"
#implementation DismissTransition
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{
return 1;
}
-(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContex{
UIViewController *from=[transitionContex viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *to=[transitionContex viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *containerView=[transitionContex containerView];
[UIView animateWithDuration:[self transitionDuration:transitionContex] animations:^{
to.view.frame = CGRectMake(0, 0, from.view.frame.size.width, from.view.frame.size.height);
to.view.alpha=1.0;
from.view.alpha=0.0;
} completion:^(BOOL finished) {
[transitionContex completeTransition:YES];
}];
}
#end
This is where my custom transition is called
#import "ViewController.h"
#import "Transition.h"
#import "DismissTransition.h"
#import "MenuViewController.h"
#interface ViewController ()<UIViewControllerTransitioningDelegate>
#end
#implementation ViewController
- (IBAction)buttonTap:(id)sender {
UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
MenuViewController* viewController = [mystoryboard instantiateViewControllerWithIdentifier:#"MenuVC"];
viewController.modalPresentationStyle=UIModalPresentationCustom;
viewController.transitioningDelegate=self;
[self presentViewController:viewController animated:YES completion:nil];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
presentingController:(UIViewController *)presenting
sourceController:(UIViewController *)source{
return [[Transition alloc]init];
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed{
return [[DismissTransition alloc]init];
}
#end
And this is how I dismiss MenuViewController
#import "MenuViewController.h"
#interface MenuViewController ()
#end
#implementation MenuViewController
- (IBAction)doneButtonTap:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
You should add to.view to containerView in DismissTransition
I'm building a graphing app, and I have a view and a view controller, which acts as a delegate for the view (to retrieve information). While I haven't started the actual drawing yet, I am currently trying to store values in a dictionary; however, I have certain NSLogs placed methodically across the view controller and I noticed that the delegate methods I call from the view don't get called at all. For example, I call my scaleForGraph function, but it does not execute. Being new to this, I'm not sure if there's something I'm missing. FYI: I have no errors, it compiles and executes. I've tried to slim the code down as much as possible. Thank you for your help!
Here's the .h for my view, where I define the protocol:
// GraphView.h
#import <UIKit/UIKit.h>
#class GraphView;
#protocol GraphViewDelegate <NSObject>
- (float)scaleForGraph:(GraphView *)requestor;
-(NSMutableDictionary*) valuesForGraph:(GraphView *)requestor withWidth:(float) width;
#end
#interface GraphView : UIView
#property (nonatomic) id <GraphViewDelegate> delegate;
#property (nonatomic) id expressionCopy;
#end
And here's the .m:
#import "GraphView.h"
#implementation GraphView
#synthesize expressionCopy = _expressionCopy;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
self.contentMode = UIViewContentModeRedraw;
}
return self;
}
- (void)awakeFromNib
{
self.contentMode = UIViewContentModeRedraw;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
CGContextRef c = UIGraphicsGetCurrentContext();
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
CGFloat width = screenSize.width;
CGFloat height = screenSize.height;
float scale = [self.delegate scaleForGraph:self];
NSLog([NSString stringWithFormat:#"My Scale: %f",scale]); //always returns 0
NSMutableDictionary *graphValues = [self.delegate valuesForGraph:self withWidth:width];
}
#end
And here's my view controller .h:
#import <UIKit/UIKit.h>
#import "GraphView.h"
#interface GraphingViewController : UIViewController <GraphViewDelegate>
#property (weak, nonatomic) IBOutlet GraphView *graphView;
#property (strong, nonatomic) IBOutlet UIStepper *stepper;
- (IBAction) changedScale:(UIStepper *)stepper;
#property (nonatomic) int scale;
#property (nonatomic) id expressionCopy;
#end
And here's the .m for the controller:
#import "GraphingViewController.h"
#interface GraphingViewController ()
#end
#implementation GraphingViewController
#synthesize expressionCopy = _expressionCopy;
- (void)updateUI
{
self.stepper.value = self.scale;
[self.graphView setNeedsDisplay];
}
- (void)setScale:(int)scale
{
if (scale < 0) scale = 0;
if (scale > 100) scale = 100;
_scale = scale;
[self updateUI];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(IBAction)changedScale:(UIStepper *)stepper {
self.scale = stepper.value; //this function works fine, but is not delegate/does not get called by view
}
-(float) scaleForGraph:(GraphView *)requestor {
NSLog(#"HI"); //never gets here
}
-(NSMutableDictionary*) valuesForGraph:(GraphView *)requestor withWidth:(float) width {
NSLog(#"Hello2"); //never gets here
}
return xyVals;
}
#end
Nowhere in the code you've posted do you tell your GraphView that the GraphingViewController is it's delegate. So, you are sending a message to nil.
You'll want to do something like:
self.graphView.delegate = self;
In your GraphingViewController setup code.
Make your controller actual delegate of GraphView. You can do it in interface builder by Ctrl-dragging from GraphView to the object (orange circle in the bottom) and than choose "delegate"
I am experiencing problems on my attempt to popup an image in my view.
I have created a new subclass of UIView (UIViewImageOverlay.m) with the image.
UIViewImageOverlay.m
// ImageOverlay.m
// ButtonPopup
//
//
#import "UIViewImageOverlay.h"
#implementation UIViewImageOverlay
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
CGContextRef contextRef = UIGraphicsGetCurrentContext();
UIImage *myImage = [UIImage imageNamed:#"test.jpeg"];
int w = myImage.size.width;
int h = myImage.size.height;
CGContextDrawImage(contextRef, CGRectMake(0, 0, w, h), myImage.CGImage);
CGContextRelease(contextRef);
}
#end
In my ViewController.m i have a button pushPush to load the view, but the attempt gives a warning
// ViewController.m
// ButtonPopup
//
//
#import "ViewController.h"
#import "UIViewImageOverlay.h"
#interface ViewController ()
#end
#implementation ViewController
#synthesize viewImageOverlay;
- (void)viewDidLoad
{
[super viewDidLoad]; // static
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
- (IBAction)pushPush:(id)sender {
[self.view addSubview:self.viewImageOverlay];
}
#end
ViewController.h
// ViewController.h
// ButtonPopup
//
#import <UIKit/UIKit.h>
#class UIViewImageOverlay;
#interface ViewController : UIViewController {
UIViewImageOverlay *viewImageOverlay;
}
#property(nonatomic, retain) UIViewImageOverlay *viewImageOverlay;
- (IBAction)pushPush:(id)sender;
#end
UIViewImageOverlay.h
// ImageOverlay.h
// ButtonPopup
//
//
#import <UIKit/UIKit.h>
#interface UIViewImageOverlay : UIView
#end
[self.view addSubview:self.viewImageOverlay]; reports Incompatible pointer types sending 'UIViewImageOverlay *' to parameter of type 'UIView *'
Thanks in advance.
declare instance variable viewImageOverlay and define it as a property
You have a forward class declaration in your controller's header file (#class UIViewImageOverlay). It shadows the correct implementation.
Include UIViewImageOverlay.h in the implementation file of your controller
I'm very new to iOS programming (Coming from Java / C++). I'm trying to set up an app with a TabBarController of which one tab should be a SplitView. I've done my research and I know that UISplitview will not work and everywhere people recommend using the MGSplitViewController. I've looked at the demo but I just can't figure out how to use it without it beeing the app's root view and can't find any sample code that could help
So here is what I do with the classes from the demo in a separate UIViewController class that I afterwards add to the TabBarController: This is my class:
#import <UIKit/UIKit.h>
#import "MGSplitCornersView.h"
#import "RootViewController.h"
#import "DetailViewController.h"
#interface ChannelViewController : UIViewController {
MGSplitViewController *splitViewController;
RootViewController *rootViewController;
DetailViewController *detailViewController;
}
#property (nonatomic, retain) MGSplitViewController *splitViewController;
#property (nonatomic, retain) RootViewController *rootViewController;
#property (nonatomic, retain) DetailViewController *detailViewController;
#end
And this is my desperate try to set it up
- (id)initWithTabBar
{
self = [super init];
//this is the label on the tab button itself
self.title = #"SplitView";
//use whatever image you want and add it to your project
//self.tabBarItem.image = [UIImage imageNamed:#"name_gray.png"];
// set the long name shown in the navigation bar at the top
self.navigationItem.title=#"Nav Title";
self.splitViewController = [[MGSplitViewController alloc] init];
self.rootViewController = [[RootViewController alloc] init];
self.detailViewController = [[DetailViewController alloc] init];
[self.splitViewController setDetailViewController:detailViewController];
[self.splitViewController setMasterViewController:rootViewController];
[self.view addSubview:splitViewController.view];
[self.rootViewController performSelector:#selector(selectFirstRow) withObject:nil afterDelay:0];
[self.detailViewController performSelector:#selector(configureView) withObject:nil afterDelay:0];
if (NO) { // whether to allow dragging the divider to move the split.
splitViewController.splitWidth = 15.0; // make it wide enough to actually drag!
splitViewController.allowsDraggingDivider = YES;
}
return self;
}
I guess I'm doing something wrong with delegates? Or do I have something else mixed up?
Is the demo doing things in the IB that I can't see in the code?
I get the split view but no content and especially no navigation bar with the buttons the demo comes with.
I'd be very thankful for hints or sample code!
Ok manny, here we go. This is my working code for the interface:
#import <UIKit/UIKit.h>
#import "MGSplitViewController.h"
#import "ecbView.h"
#import "ecbCalc.h"
#interface splitMain : MGSplitViewController <UIPopoverControllerDelegate,
MGSplitViewControllerDelegate>
{
IBOutlet UIPopoverController* popoverController;
IBOutlet UINavigationController* naviController;
IBOutlet ecbCalc* viewCalcLeft;
IBOutlet ecbView* euroRatesRight;
UIBarButtonItem* savedButtonItem;
BOOL keepMasterInPortraitMode;
BOOL memoryWasDropped;
BOOL viewLoaded;
}
#property (nonatomic, retain) UIPopoverController* popoverController;
#property (nonatomic, retain) UINavigationController* naviController;
#property (nonatomic, retain) ecbCalc* viewCalcLeft;
#property (nonatomic, retain) ecbView* euroRatesRight;
#property (nonatomic, retain) UIBarButtonItem* savedButtonItem;
#property (nonatomic, readonly) BOOL keepMasterInPortraitMode;
#property (nonatomic, readonly) BOOL memoryWasDropped;
#property (nonatomic, readonly) BOOL viewLoaded;
- (void)dismissPopoverController: (BOOL)animated;
- (void)settingsChanged;
#end
and here excerpts from implementation file:
- (id)initWithCoder:(NSCoder *)aDecoder
{
if ((self = [super initWithCoder:aDecoder]))
{
// my initialization...
}
return self;
}
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
CGRect rectFrame = CGRectMake(0.0, 20.0, 768.0, 1004.0 - 48.0); // being above a tab bar!
viewLoaded = NO;
self.view = [[UIView alloc] initWithFrame:rectFrame];
viewCalcLeft = [[ecbCalc alloc] initWithNibName:#"ecbCalc" bundle:nil];
euroRatesRight = [[ecbView alloc] initWithNibName:#"ecbView-iPad" bundle:nil];
naviController = [[UINavigationController alloc] initWithRootViewController:self.viewCalcLeft];
naviController.navigationBar.barStyle = UIBarStyleBlack;
naviController.title = nil;
viewCalcLeft.title = NSLocalizedString(#"BtnTitleCalc", #"");
viewCalcLeft.view.hidden = NO;
NSUserDefaults* prefs = [NSUserDefaults standardUserDefaults];
if ([prefs objectForKey:#"iPadAlwaysSplitTableView"] != nil)
self.keepMasterInPortraitMode = [prefs boolForKey:#"iPadAlwaysSplitTableView"];
else
self.keepMasterInPortraitMode = YES;
NSArray* theViewControllers = [NSArray arrayWithObjects:self.naviController, self.euroRatesRight, nil];
[self setViewControllers:theViewControllers];
[self setDelegate:self];
[self setShowsMasterInPortrait:keepMasterInPortraitMode];
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
// protection because this one is called twice
if (viewLoaded)
return;
[super viewDidLoad];
if (memoryWasDropped)
{
if (!self.keepMasterInPortraitMode && UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
{
// recreate popover controller
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:self.viewCalcLeft];
}
}
viewLoaded = YES;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
memoryWasDropped = YES;
// Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
[self dismissPopoverController:NO];
self.popoverController = nil;
self.naviController = nil;
self.viewCalcLeft = nil;
self.euroRatesRight = nil;
viewLoaded = NO;
}
My MainWindow.xib has a UITabBarController and the button for splitMain is configured for this class but with an empty xib entry. So creation has to go via loadView. Maybe I could have done the viewDidLoad stuff within loadView ... but so I had to protect viewDidLoad from being called twice. That happens in loadView as soon as the view is instantiated from MGSplitViewController class because the initWithCoder there is calling [self setup]. In that function the frame rect is calculated with self.view.bounds so that viewDidLoad is called again because the view doesn't exist yet. Maybe one could implement a workaround within MGSplitViewController.m but I was too lazy doing that.
To get this working on a tab bar controller please make sure you commit most of the changes that are published on the MGSplitViewController's git page. Good luck.