Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ios7中的自定义侧栏_Ios_Uiviewanimation_Sidebar - Fatal编程技术网

ios7中的自定义侧栏

ios7中的自定义侧栏,ios,uiviewanimation,sidebar,Ios,Uiviewanimation,Sidebar,我是iOS开发新手,面临的问题很少。我不知道这种方法是好是坏,但我不想使用任何第三方。我想让边栏像Facebook边栏一样,我的代码是 - (IBAction)basicProfile:(id)sender { menuViewController *destVC = [self.storyboard instantiateViewControllerWithIdentifier:@"menuView"]; CATransition *animation = [CATran

我是iOS开发新手,面临的问题很少。我不知道这种方法是好是坏,但我不想使用任何第三方。我想让边栏像Facebook边栏一样,我的代码是

- (IBAction)basicProfile:(id)sender {

    menuViewController *destVC = [self.storyboard instantiateViewControllerWithIdentifier:@"menuView"];


    CATransition *animation = [CATransition animation];
    [animation setDuration:0.5];
    [animation setType:kCATransitionPush];
    [animation setSubtype:kCATransitionFromLeft];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    CGRect view = self.view.frame;
    view.origin.x = 280;




    if(self.view.frame.origin.x > 100 )
    {
        [UIView beginAnimations:nil context:(__bridge void *)(self.scrollView)];
        [UIView setAnimationDuration:0.25];
        NSLog(@"%f", self.view.frame.origin.y);
        self.view.frame = CGRectMake(0,0,320,568);
        [UIView commitAnimations];

    }

    else{
        [self.showView setHidden:NO];
    [UIView beginAnimations:nil context:(__bridge void *)(self.scrollView)];
    [UIView setAnimationDuration:0.25];
    NSLog(@"%f", self.view.frame.origin.y);
    self.view.frame = CGRectMake(280,0,320,568);
    [UIView commitAnimations];
        [self.view addSubview:destVC.view]; // this line added menuView to profile view but not on sidebar 
    }
}
我在storyborad中有两个uiview,一个是profile,另一个是menuView控制器。为什么menuView没有正确加载

步骤01:基本上您需要的是一个viewController和两个视图(一个用于侧栏,另一个用于主视图)

步骤02:您需要将这两个视图添加到视图控制器中

步骤03:然后添加一个按钮以使用以下命令进行切换:

-

注意:已经有了关于堆栈溢出的解释

您可以按照以下步骤操作:


如果您的要求不同,请发表评论。

有两种方法可以做到这一点:

  • 在同一控制器上使用2个UIView。您可以将菜单视图与视图一起添加,并将其隐藏。使用按钮切换以显示/隐藏菜单。显示/隐藏视图的方式与xview.hidden=TRUE/xview.hidden=FALSE类似。可以使用动画为其提供类似菜单的外观

  • 为MenuDisplay使用不同的视图控制器,并将其添加到当前视图控制器,如[xview addsubView:menuview.view]和[menuview.view removefromsuperview]

  • +1:我不想使用任何第三方。否:(我仍在搜索,但暂时我使用了这个CDR半透明侧边栏库。
    (void)OnCollapsibleExtenderTouchUpInside
    {
       [UIView animateWithDuration:1.0 animations:^{
    
        [sideBarObj ToggleVuPosition];
    
        [mainVuObj ToggleVuSize];
    
     }];
    
    }