我使用JASidePanels在屏幕的右侧显示一个viewController。控制器以这种方式从主情节提要中从JASidePanelController子类加载:
-(void)awakeFromNib{
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
TRMPracticeViewController *practiceVC = [mainStoryboard instantiateViewControllerWithIdentifier:@"Practice"];
TRMPracticeSetupViewController *practiceSetup = [mainStoryboard instantiateViewControllerWithIdentifier:@"PracticeSetupVC"];
[self setCenterPanel:practiceVC];
[self setRightPanel:practiceSetup];
[self setRightFixedWidth:practiceVC.view.frame.size.width/3.0f];
}TRMPracticeSetupViewController在故事板中有一个固定的帧(200 px 320 Px),一旦控制器加载并添加到侧(或至少与屏幕大小成比例的宽度),我希望保持宽度。
但是,一旦加载并添加了vc,它的帧将设置为中心视图控制器,后者当然具有屏幕的大小。因此,右vc中的视图在中心vc下面,因为自动布局约束将它们的边距固定到容器边界。
如何将正确的面板边界宽度修正为200 fix?
发布于 2015-03-24 09:36:12
JASidePanelController有一种设置左右面板固定宽度的方法。只需将此添加到代码中:
self.rightFixedWidth = 200.0f;https://stackoverflow.com/questions/28427615
复制相似问题