
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];
I suggest creating a category on UISplitVIEwController that implements a setter for the
_hIDesMasterVIEwInPortrait member variable.
@interface UISplitVIEwController (ShowMasterInPortrait)
- (voID)setHIDesMasterVIEwInPortrait:(BOol)hIDden;
@end
@implementation UISplitVIEwController (ShowMasterInPortrait)
- (voID)setHIDesMasterVIEwInPortrait:(BOol)hIDden
{
_hIDesMasterVIEwInPortrait = (hIDden) ? 0 : 1;
}
@end Report
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
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 { returnself 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.
以上是内存溢出为你收集整理的iOS splitviewer controller全部内容,希望文章能够帮你解决iOS splitviewer controller所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)