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 8019943
In Process

The Archive Base Latest Questions

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

So I have a UIView which I call ctrView and this ctrView is added

  • 0

So I have a UIView which I call ctrView and this ctrView is added to my UIViewController’s view. It’s basically just a smaller rectangular frame inside. And I added a UIButton on the top right corner of this container view, however it seems that when clicking on the UIButton area which is a bit outside of the ctrView doesn’t trigger the action tied to the button. Only the UIButton area that is inside the container view triggers the action. How do I resolve this weird issue?

UIButton *closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    [closeButton setImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal];
    [closeButton setBackgroundColor:[UIColor clearColor]];
    [closeButton addTarget:self action:@selector(closeZoomedImageView) forControlEvents:UIControlEventTouchUpInside];
    [closeButton setCenter:CGPointMake(ctrView.frameX + ctrView.frameWidth - 30, ctrView.frameY - 15)];
    [ctrView addSubview:closeButton];
    [closeButton release];
  • 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-04T21:32:50+00:00Added an answer on June 4, 2026 at 9:32 pm

    This is the normal behavior, views outside the bound of the parent will not receive touch actions
    In order to fix this, rearrange the views like following

    • Main view will be big enough to accomodate the internal view and the closebutton, the backGroundColor of this view will be clear color
    • Internal view will be the view that will the internal view that will have the image and or the content of your normal view

    Main view will have both the internal view and the close button as its childern
    Main view will be big enough to accomodate the button
    Main view will have a clear color background so that it will not affect the layout

    So you will add all the views you currently have inside the internal view,
    The internal view and the button view will both be added to the main view

    you present then the main view to the viewcontroller

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

Sidebar

Related Questions

i have a custom UIView which is presented from a UIViewController . This view
I have a UIView in which I added a UITapGestureRecognizer . Inside that view
In a universal app, I have a UIView which is presented inside an iPhone-Screen-Sized
I have uisearchbar in a uiview which is already subview of a uiviewController, I
I have a uitableview inside and uiview which is being presented in a navigation
I have subclassed UIView object inside a uiscrollview which displays a pdf page. I
I have a UIViewController Class which holds 2 custom UIView classes which are: ItemView
Lets say that I have 4 view controllers (call them FirstView,SecondView,ThirdView,FourthView) which are created
Im have a subclass of UIView, called PinView, which contains an image. Basically PinView
I have a UIView class which I am currently removing from my view by

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.