Build a custom share panel of buttons

2019-06-08 17:33发布

问题:

I am trying to build a custom share panel with buttons.

  • This is how it appears before being clicked.

  • This is how it appears after.

I know that may be complicated, but I need the steps to accomplish this.

The images show the mock-ups of the panel.

回答1:

You just think complicated. It is not complicated; all you need is a view on the main window with this arrow custom button, when click it just move it from bottom to top.



回答2:

I found the solution.

  • Create the user interface.

  • Link the user interface with IBoutlets and IBActions.

  • Animate the UIView item with buttons.

    -(IBAction) openPanelBtnPressed:(id)sender{
    CGPoint wpos = self.panel.frame.origin ;
    if(wpos.x == 0 && wpos.y ==133){
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:1];
        [UIView setAnimationBeginsFromCurrentState:YES];
        self.panel.frame=CGRectMake(0.0,330, 76, 368);
        self.panel.transform = CGAffineTransformIdentity;  
        [UIView commitAnimations];
    UIImage * imgOpenPanelBtn = [UIImage imageNamed:@"up.png"];
    [self.btnOpenPanel setImage:imgOpenPanelBtn forState:UIControlStateNormal];
    
     }else {
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:1];
            [UIView setAnimationBeginsFromCurrentState:YES];
            self.panel.frame=CGRectMake(0.0, 133.0, 76, 368);
             self.panel.transform = CGAffineTransformIdentity;  
            [UIView commitAnimations];
            UIImage * imgOpenPanelBtn = [UIImage imageNamed:@"down.png"];
            [self.btnOpenPanel setImage:imgOpenPanelBtn forState:UIControlStateNormal];
    
     }
     }
    
  • The result is this one: http://www.youtube.com/watch?v=6zoZKjbZAps.

  • You can find the explanation in Arabic on my blog.

  • You can download the project.