[英]Subclass UISplitViewController and set custom width
I'm trying to subclass UISplitViewController to decrease the width of the master. 我正在尝试对UISplitViewController进行子类化以减小主控件的宽度。 I've looked at Matt Gemmell's MGSplitViewController - see Change the width of Master in UISplitViewController - but it looks like way more than I need.
我看过Matt Gemmell的MGSplitViewController-请参阅在UISplitViewController中更改Master的宽度 -但这看起来超出了我的需要。 I just want to decrease the size of the master from 320 to 260 in a way that Apple will accept in the app store.
我只是想将母版的大小从320减小到260,这是Apple可以在应用商店中接受的方式。
I'm new to subclassing anything other than a button, but this is what I'm trying so far, although it currently doesn't do anything. 我是除按钮之外的其他子类的新手,但这是我到目前为止正在尝试的工作,尽管它目前不执行任何操作。 Either I'm way off the mark or I'm missing something simple.
我要么偏离标准,要么错过了一些简单的事情。 How can this be done?
如何才能做到这一点?
Header file: 头文件:
#import <UIKit/UIKit.h>
@interface MYSplitViewController : UISplitViewController
+ (CGFloat)masterColumnWidth;
@end
Implementation file: 实施文件:
#import "SRSplitViewController.h"
@interface SRSplitViewController ()
@end
@implementation SRSplitViewController
+ (CGFloat)masterColumnWidth {
return 260;
}
@end
I ended up not going this route, and would recommend against trying to subclass UISplitViewController for others. 我最终没有走这条路线,并建议不要尝试为其他人继承UISplitViewController。 It's not a flexible layout so unless you want exactly what it provides out of the box, you are going to run into time-consuming problems.
这不是一个灵活的布局,因此除非您确实想要开箱即用的功能,否则您将遇到耗时的问题。
If you want a side navigation bar similar to the Facebook app, I'd recommend using JASidePanels and placing whatever size and style view controller you want in the left panel. 如果您想要类似于Facebook应用程序的侧面导航栏,我建议您使用JASidePanels并在左侧面板中放置所需的任何大小和样式的视图控制器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.