iPhone Modal View Smaller that the screen

后端 未结 5 1049
一生所求
一生所求 2021-01-31 06:23

I\'m trying to do something that shouldn\'t be that complicated, but I can\'t figure it out. I have a UIViewController displaying a UITableView. I want to present a context menu

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 07:08

    I'm coding similar thing. My approach include.....

    1. Not using dismissModalViewControllerAnimated and presentModalViewController:animated.

    2. Design a customized full sized view in IB. In its viewDidLoad message body, set the background color to clearColor, so that space on the view not covered by controllers are transparent.

    3. I put a UIImageView under the controllers of the floating view. The UIImageView contains a photoshoped image, which has rounded corners and the background is set to transparent. This image view serves as the container.

    4. I uses CoreAnimation to present/dismiss the floating view in the modal view style: (the FloatingViewController.m)

      -  (void)viewDidLoad
      {
          [super viewDidLoad];
          [self.view setBackgroundColor:[UIColor clearColor]];
      
          [UIView beginAnimations:nil context:nil];
          [self.view setFrame:CGRectMake(0, 480, 320, 480)];
      
          [UIView setAnimationDuration:0.75f];
          [self.view setFrame:CGRectMake(0, 0, 320, 480)];
          [UIView commitAnimations];
      }
      

提交回复
热议问题