HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iOS splitviewer controller大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_673_4@http://useyourloaf.com/blog/2011/10/19/ios-5-split-view-controller-changes.html

@H_673_4@

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];

@H_673_4@

@H_673_4@

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
@H_616_66@

@H_673_4@ @H_673_4@for iOS 5:

@H_673_4@http://useyourloaf.com/blog/2011/10/19/ios-5-split-view-controller-changes.html

@H_673_4@

@H_673_4@

@H_673_4@http://www.edumobile.org/iphone/ipad-development/splitview-application-in-ipad/

@H_673_4@

@H_673_4@

@H_673_4@其实,很多时候的解决方法是真的不是真的可行的,要不停尝试:

@H_673_4@http://stackoverflow.com/questions/4624234/forcing-an-ipad-app-to-show-splitview-even-in-porTrait-orientationlike-the-sett

@H_673_4@as this guy:

@H_673_4@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.

@H_673_4@yeah. i am that guy also....

@H_673_4@haha,you can see this :

@H_673_4@

here is the way it works

[splitViewController setHidesmasterViewInPorTrait:NO];

 //[self.splitViewController setHidesmasterViewInPorTrait:NO]; //这个在iOS SDKbase 5.1 的情况下似乎也是不 work的。so find normal support way,走正道才是王道啊


@H_673_4@

@H_673_4@要访问私有变量,要尽量绕开编译器的检查::: 再次提示走正道才是王道

@H_673_4@

_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*)@H_827_126@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所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。