Open UISplitViewController to Master View rather than Detail

Swift UISplitViewController display master view above detail in portrait orientation is not about showing the Master view, it is about presenting the Detail view in full width, underneath the Master view. UISplitViewController in portrait on iPhone shows detail VC instead of master is about the principle of the collapse mechanism. This present answer addresses: Master … Read more

UITableViewCell Set selected initially

For the cell to appear selected, you have to call -setSelected:animated: from within -tableView:willDisplayCell:forRowAtIndexPath: like so: – (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if (/* should be selected */) { [cell setSelected:YES animated:NO]; } } Calling -setSelected from anywhere else has no effect.

UISplitViewController in a TabBar ( UITabBarController )?

Using the interface builder, create a split view controller and a tab bar controller and link them to your outlets: @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController; In your app delegate didFinishLaunchingWithOption, assign your split view controller to the tab bar controller: splitViewController.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@”Title” image:nil tag:0] autorelease]; … Read more

Change the width of Master in UISplitViewController

If you subclass UISplitViewController, you can implement -viewDidLayoutSubviews and adjust the width there. This is clean, no hacks or private APIs, and works even with rotation. – (void)viewDidLayoutSubviews { const CGFloat kMasterViewWidth = 240.0; UIViewController *masterViewController = [self.viewControllers objectAtIndex:0]; UIViewController *detailViewController = [self.viewControllers objectAtIndex:1]; if (detailViewController.view.frame.origin.x > 0.0) { // Adjust the width of the … Read more

Best way to switch between UISplitViewController and other view controllers?

I seriously didn’t believe that this concept of having some UIViewController to show before UISplitViewController (login form for example) turns out to be so complicated, until I had to create that kind of view hiearchy. My example is based on iOS 8 and XCode 6.0 (Swift), so I’m not sure if this problem existed before … Read more