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

  • Home
  • SEARCH
  • 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 8013993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:47:49+00:00 2026-06-04T19:47:49+00:00

Wondering if anyone can shed some light on how to create a semi-transparent Help

  • 0

Wondering if anyone can shed some light on how to create a semi-transparent Help screen on an ipad or iphone app? Something similar to Googles app.

I have a splitViewController and I want to overlay a see-through black overlay on top of the splitViewController where I can show Help information about each item you can click in the splitViewController.

I followed http://cocoawithlove.com/2009/04/showing-message-over-iphone-keyboard.html which gets me the overlay, but I am now adding clickable UIViews (eg a close button to dismiss the overlay). The issue is when I setup touchesEnded:withEvent I cannot seem to convert clicks from the main LoadingView to closeButton to see what was actually clicked?

See the touches ended at the end of the code

================================================================

#import "HelpView.h"
#import <QuartzCore/QuartzCore.h>

//

CGPathRef NewPathWithRoundRect(CGRect rect, CGFloat cornerRadius)
{
//
// Create the boundary path
//
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL,
    rect.origin.x,
    rect.origin.y + rect.size.height - cornerRadius);

// Top left corner
CGPathAddArcToPoint(path, NULL,
    rect.origin.x,
    rect.origin.y,
    rect.origin.x + rect.size.width,
    rect.origin.y,
    cornerRadius);

// Top right corner
CGPathAddArcToPoint(path, NULL,
    rect.origin.x + rect.size.width,
    rect.origin.y,
    rect.origin.x + rect.size.width,
    rect.origin.y + rect.size.height,
    cornerRadius);

// Bottom right corner
CGPathAddArcToPoint(path, NULL,
    rect.origin.x + rect.size.width,
    rect.origin.y + rect.size.height,
    rect.origin.x,
    rect.origin.y + rect.size.height,
    cornerRadius);

// Bottom left corner
CGPathAddArcToPoint(path, NULL,
    rect.origin.x,
    rect.origin.y + rect.size.height,
    rect.origin.x,
    rect.origin.y,
    cornerRadius);

// Close the path at the rounded rect
CGPathCloseSubpath(path);

return path;
}

@implementation HelpView

@synthesize closeButton = _closeButton;

- (id)loadingViewInView:(UIView *)aSuperview
{


HelpView *loadingView =
    [[HelpView alloc] initWithFrame:[aSuperview bounds]];
if (!loadingView)
{
    return nil;
}

loadingView.opaque = NO;
loadingView.autoresizingMask =
    UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[aSuperview addSubview:loadingView];

const CGFloat DEFAULT_LABEL_WIDTH = 100.0;
const CGFloat DEFAULT_LABEL_HEIGHT = 40.0;
CGRect labelFrame = CGRectMake(0, 0, DEFAULT_LABEL_WIDTH, DEFAULT_LABEL_HEIGHT);
UILabel *loadingLabel = [[UILabel alloc] initWithFrame:labelFrame];
loadingLabel.text = NSLocalizedString(@"Close", nil);
loadingLabel.textColor = [UIColor whiteColor];
loadingLabel.backgroundColor = [UIColor clearColor];
loadingLabel.textAlignment = UITextAlignmentCenter;
loadingLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
loadingLabel.autoresizingMask =
    UIViewAutoresizingFlexibleLeftMargin |
    UIViewAutoresizingFlexibleRightMargin |
    UIViewAutoresizingFlexibleTopMargin |
    UIViewAutoresizingFlexibleBottomMargin;


// Background for Close button
CALayer *closeButtonBackground = [CALayer layer];
closeButtonBackground.opacity = 0.3;
closeButtonBackground.borderColor = [UIColor whiteColor].CGColor;
closeButtonBackground.borderWidth = 2.0;
closeButtonBackground.cornerRadius = 5.0;
closeButtonBackground.backgroundColor = [UIColor blackColor].CGColor;

// Finish setting up frame for Close button
labelFrame.origin.x = 0;
labelFrame.origin.y = 0;
loadingLabel.frame = labelFrame;
closeButtonBackground.frame = labelFrame;



CGRect viewRect = CGRectMake(loadingView.frame.size.width -150   ,loadingView.frame.size.height - 85,100,40);
self.closeButton = [[UIView alloc] initWithFrame:viewRect];
self.closeButton.userInteractionEnabled = YES;
self.userInteractionEnabled = NO;
[loadingView addSubview:self.closeButton];
[self.closeButton.layer addSublayer:closeButtonBackground]; 
[self.closeButton addSubview:loadingLabel];


// Set up the fade-in animation
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];
[[aSuperview layer] addAnimation:animation forKey:@"layerAnimation"];

//[loadingView createGestureRecognizer];

return loadingView;
}




- (void)removeView
{
UIView *aSuperview = [self superview];
[super removeFromSuperview];

// Set up the animation
CATransition *animation = [CATransition animation];
[animation setType:kCATransitionFade];

[[aSuperview layer] addAnimation:animation forKey:@"layerAnimation"];
}


- (void)drawRect:(CGRect)rect
{
rect.size.height -= 1;
rect.size.width -= 1;

const CGFloat RECT_PADDING = 0.0;
rect = CGRectInset(rect, RECT_PADDING, RECT_PADDING);

const CGFloat ROUND_RECT_CORNER_RADIUS = 0.0;
CGPathRef roundRectPath = NewPathWithRoundRect(rect, ROUND_RECT_CORNER_RADIUS);

CGContextRef context = UIGraphicsGetCurrentContext();

const CGFloat BACKGROUND_OPACITY = 0.85;
CGContextSetRGBFillColor(context, 0, 0, 0, BACKGROUND_OPACITY);
CGContextAddPath(context, roundRectPath);
CGContextFillPath(context);

const CGFloat STROKE_OPACITY = 0.25;
CGContextSetRGBStrokeColor(context, 1, 1, 1, STROKE_OPACITY);
CGContextAddPath(context, roundRectPath);
CGContextStrokePath(context);

CGPathRelease(roundRectPath);
}

- (void)handleSingleDoubleTap:(UITapGestureRecognizer *)sender {
NSLog(@"");    
CGPoint tapPoint = [sender locationInView:sender.view];
CALayer* layerThatWasTapped = [self.layer hitTest:tapPoint];

CGPoint convertedPoint = [layerThatWasTapped convertPoint:layerThatWasTapped.position toLayer:self.closeButton.layer];
BOOL myBool = [self.closeButton.layer containsPoint:convertedPoint];


[UIView beginAnimations:nil context:NULL];

sender.view.center = tapPoint;

[UIView commitAnimations];
}

- (void) touchesEnded: (NSSet *) touches  withEvent: (UIEvent *) event {
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView: self];
CGPoint convertedPoint = [self convertPoint:point toView:[self.closeButton superview]];

if (CGRectContainsPoint(self.closeButton.bounds, convertedPoint)) {
    NSLog (@"YAY!");
}

} // touchesEnded
  • 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-04T19:47:51+00:00Added an answer on June 4, 2026 at 7:47 pm

    Solved this with NSNotifications. Something like this… its a little static… should be more dynamic.

     [[NSNotificationCenter defaultCenter]
       addObserver:self
       selector:@selector(eventHandler:)
       name:@"SomeButtonClicked"
       object:nil ];
    
    -(void)eventHandler: (NSNotification *) notification
    {
        NSString *buttonWhichWasClicked = [[notification userInfo]   objectForKey:@"buttonName"];
        NSLog(@" %@", buttonWhichWasClicked);
    
        if ([buttonWhichWasClicked isEqualToString:@"close"]){
        [self removeView];
        }
         //Tell other buttons to dim/remove themselves as a new one was selected
     }
    
    - (void)removeView
    {
    //code to remove view
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering if anyone can shed some light on the basics of getter setters
Was wondering is anyone can shed some light onto why my subtotal is 1,
I was wondering if anyone could shed some light on improvements I can do
I'm wondering if anyone can shed some light on the following issue with Matlab
Wondering if anyone out there can shed some light on why the following regular
I am wondering if anyone can shed some lights on the situation. I am
This is bizarre, I was wondering if anyone could shed some light on why
Wondering if anyone can help with this. I have a table with some fixed
I was wondering if anyone can shed a light on the error I get
I'm wondering if anyone can shed some insight as to the best practice for

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.