How to create popover in iPhone app?

前端 未结 2 1296
时光说笑
时光说笑 2020-12-13 01:12

I\'m looking for popover in iPhone and i want to make it like iOS 5 Reader feature:

\"enter

2条回答
  •  一向
    一向 (楼主)
    2020-12-13 01:56

    You could make a UIView with some custom artwork and display it with an animation on top of your view as a "popover" with some buttons like so:

    UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(25, 25, 100, 50)]; //<- change to where you want it to show.
    
    //Set the customView properties
    customView.alpha = 0.0;
    customView.layer.cornerRadius = 5;
    customView.layer.borderWidth = 1.5f;
    customView.layer.masksToBounds = YES;
    
    //Add the customView to the current view
    [self.view addSubview:customView];
    
    //Display the customView with animation
    [UIView animateWithDuration:0.4 animations:^{
        [customView setAlpha:1.0];
    } completion:^(BOOL finished) {}];
    

    Don't forget to #import , if you want to use the customView.layer.

提交回复
热议问题