http://useyourloaf.com/blog/2011/10/19/ios-5-split-view-controller-changes.html
The split view is something very cool within the new iPhone OS 3.2. It allows us to visualize a master-detail view in a very simple manner. Combined with iPads’ big display of 1024×748 pixels it will be possible to create even better, more user-friendly and valuable applications.
Basically, the split view consists of two separate views. The master view will be shown in a 320 pixel width part on your screen if your iPad is at landscape orientation, otherwise the master view will be accessible as a popover view. The details view should show your main content and will be at full size if your iPad is at portrait orientation. Mainly the user will be focused at your details view and this fact you should keep in mind.
Creating a split view pragmatically within your application is a easy task. The following code will show this:
//adjust detail view f = detail.view.frame; f.size.width = 830; f.size.height = 1024; f.origin.x = 320; f.origin.y = 0; [detail.view setFrame:f];
for iOS 5:
http://useyourloaf.com/blog/2011/10/19/ios-5-split-view-controller-changes.html
http://www.edumobile.org/iphone/ipad-development/splitview-application-in-ipad/
其实,很多时候的解决方法是真的不是真的可行的,要不停尝试:
http://stackoverflow.com/questions/4624234/forcing-an-ipad-app-to-show-splitview-even-in-portrait-orientationlike-the-sett
as this guy:
I am trying to develop a splitView based iPad app, that displays the split interface in every orientation. I have tried subclassing the UISplitViewController class as given in this tutorial, but it doesn't work. I tried creating a category to set _hidesMasterViewInPortrait = (hidden) ? 0 : 1;
, as suggested in one of the comments in the above blog, but nothing worked.
yeah. i am that guy also....
haha, you can see this :
here is the way it works
[splitViewController setHidesMasterViewInPortrait:NO];
//[self.splitViewController setHidesMasterViewInPortrait:NO]; //这个在iOS SDKbase 5.1 的情况下似乎也是不 work的。so find normal support way,走正道才是王道啊
要访问私有变量,要尽量绕开编译器的检查::: 再次提示,走正道才是王道
_displayedItems
is a private ivar, so you shouldn't access it, even from a category.
That said, you should try compiling the same code with
gcc -arch i386
and
gcc -arch x86_64
and see the difference. In the 32 bit mode you don't see the error. This shows how fragile the situation is. You really shouldn't.
That said, there's a way to get that ivar by abusing KVC:
@implementation NSCollectionView (displayedItems) - (NSMutableArray *)myDisplayedItems { return [self valueForKey:@"displayedItems"]; } @end
Note that you shouldn't name your method just as displayedItems
. That would make an infinite loop, because the KVC machinery would find your method earlier than the ivar.