The manual (Listing 5-2) says that the split view controller can be added to the UIWindow like thus:
[window addSubview:splitVC.view];
However, in an example code I have seen the following to be working perfectly fine.
[window setRootViewController:splitVC];
What is the difference between these?
They both do the same thing in this case but there are differences between
addSubviewandsetRootViewController.addSubViewis a method ofUIViewwhereasUIWindowinherits fromUIViewand therefore the method, while itsrootviewcontrollerproperty is fromUIWindowclass. But the differences in the methods areaddSubviewadds the view into the callers view hierarchy and thecalling object retains ownership.
setRootViewControllersets the view as the windows only view or mainview, if you will. An additional point is that it removes all subviews,if any, while addSubView does not do that.