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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:35:21+00:00 2026-05-23T16:35:21+00:00

I am writing a simple app where I have a UIImageView that when clicked

  • 0

I am writing a simple app where I have a UIImageView that when clicked on, should open a UIImagePickerController, and once an image is selected, is should just assign that image to the UIImageView

I started by sub-classing UIImageView, and giving it a touchesBegan which would open an ImagePicker.

My question is, since only a UIViewController can call presentModalViewController to show the imagePicker, how should I go about this?

It’s bad design to have your a view reference it’s controller (though I guess my imageview is a subview). So I don’t know how I’d pass the message up to the controller.

The other option is to detect touches in the controller to begin with, but then the only way I can see to tell if the touch was on the imageview is to actually test if the touch is within the frame of the imageview. This approach seems clunky to me… Am I missing something obvious?

Any thoughts on which method to go with, or any suggestions on a better method would be much appreciated! Thanks!

  • 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-05-23T16:35:22+00:00Added an answer on May 23, 2026 at 4:35 pm

    You don’t necessarily need to subclass UIImageView to do this. You can have it as a subview of your main UIView for some UIViewController, and add a UIGestureRecognizer to the UIImageView. Then the method that tapping or swiping the UIImageView triggers will be in your UIViewController, so you can easily present a modal view from there.

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

Sidebar

Related Questions

I'm writing a simple app that takes standard input from the user. As for
I am writing a simple salesforce app that requires app-level and user-level configuration. I
I'm writing a simple app to display some data on a DataGrid. The data
I am writing a simple test app to experiment with the functionality of node.js
I am having a strange problem with a simple test app I am writing
For an ios app I'm writing, I'd like to take an photo from the
We are writing simple architectured software in C# 3.5 . What I was searching
In order for reuse ability on iOS, I would like to write the logic
I'm thinking about setting up a website (based on WordPress) to host video tutorials

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.