Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok manny, here we go. This is my working code for the interface:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "MGSplitViewController.h" #import "ecbView.h" #import "ecbCalc.h" @interface splitMain : MGSplitViewController &lt;UIPopoverControllerDelegate, MGSplitViewControllerDelegate&gt; { 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 </code></pre> <p>and here excerpts from implementation file:</p> <pre><code>- (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 &amp;&amp; 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; } </code></pre> <p>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 <em>[self setup]</em>. 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.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload