user1898829
user1898829

Reputation: 3517

How to make view appear over button? Objective-c

What I do to display a view when a user taps on something I hide a view out of sight and then slide it in. It slides over my segment control but not over my button. enter image description here The second image shows my slide event going over the segment control but not the button leaving the button there which looks awkward. How can I show a slide coming from the right that appears over all my components including my today button? enter image description here

here is my code to show the slide controller.

    self.eventsViewController = nil;
    self.eventsViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"eventsViewController"];
    self.eventsViewController.view.frame = CGRectMake(self.view.frame.size.width, self.view.frame.origin.y, 700, self.view.frame.size.height);
    [self addChildViewController:self.eventsViewController];
    [self.view addSubview:self.eventsViewController.view];
    [self.eventsViewController didMoveToParentViewController:self];
    [UIView animateWithDuration:0.44 animations: ^(void){
        if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
        {
            self.eventsViewController.view.frame = CGRectMake(200 , 75 ,568 ,900);
        } else {
            self.eventsViewController.view.frame = CGRectMake(333 , 75 ,690 ,630);
        }

}];

edit: image of eventsViewController with colour

enter image description here

Upvotes: 4

Views: 2264

Answers (1)

Davi Stuart
Davi Stuart

Reputation: 269

Did you tried to bring your view to front?

[self.view bringSubviewToFront:self.eventsViewController.view];

Or send to back your button.

Upvotes: 2

Related Questions