Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7867513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:43:58+00:00 2026-06-03T00:43:58+00:00

Im building a custom UIView similar to UIPopover view , simply I subclass the

  • 0

Im building a custom UIView similar to UIPopover view , simply I subclass the UIView class and build the stuff of controls and events inside .. to show this view I assign the superView through My sub Class datasource like this

    if ([dataSource respondsToSelector:@selector(containerView)]) 
        superView = [dataSource containerView];

and to show it I have a function doing that like this

- (void) showPopOverFromRect : (CGRect) rect
{
    CGSize popSize = self.frame.size;

    float yPoint;

    if(ntPopOverDirection == NTPopOverArrowDirectionUP)
        yPoint = rect.origin.y + 10;
    else
        yPoint = rect.origin.y - 10;

    self.frame = CGRectMake(rect.origin.x - popSize.width, yPoint , popSize.width, popSize.height);

    [superView addSubview:self];
}

so My Question .. how can i dismiss this view (remove it) if the user tap AnyWhere on the superView just like the UIPopOverController ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:43:59+00:00Added an answer on June 3, 2026 at 12:43 am

    You could place a UIButton below your new UIView that is clear. When this new button is pressed, it dismisses your view and removes itself from superview.

    Something like:

    - (void) showPopOverFromRect : (CGRect) rect
    {
        CGSize popSize = self.frame.size;
    
        float yPoint;
    
        if(ntPopOverDirection == NTPopOverArrowDirectionUP)
            yPoint = rect.origin.y + 10;
        else
            yPoint = rect.origin.y - 10;
    
        self.frame = CGRectMake(rect.origin.x - popSize.width, yPoint , popSize.width, popSize.height);
    
        UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom];
        dismissButton.backgroundColor = [UIColor clearColor];
        dismissButton.frame = [[UIScreen mainScreen] bounds];
        [dismissButton addTarget:self.delegate action:@selector(dismissPopover) forControlEvents:UIControlEventTouchUpInside];
        [superview addSubview:dismissButton];
    
        [superView addSubview:self];
    }
    

    You’d have to set up the view to set it’s superview as a delegate that receives the message to dismiss the popover, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a custom UIView, which draws its own content in a drawRect: Method.
When building a custom frame/view in iOS code, how do you set its rotation
I am building a custom component, and I've decided to build it with a
I’m trying to build my custom segue, similar in behavior to standard Push segue,
I'm building a custom UIView for some custom drawing. So I subclassed UIView -
I've got a view controller that contains a @property which is a custom subclass
I am building a custom, in-application settings view based on UITableViewCellStyle1 (or so). I
I'm currently building some custom controls in Silverlight. I want these controls to respond
I asked a question about building custom Thread Safe Generic List now I am
I am building a custom field feature for my application. This allows the administrator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.