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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:12:10+00:00 2026-05-23T23:12:10+00:00

I have an iPhone apps in which i want to insert a event like

  • 0

I have an iPhone apps in which i want to insert a event like as when user tap on image view then a image view open which upload image from URL instead of zoom function. how can i do that in my code ? i show my code below:

- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {

    // Tap view for background
    tapView = [[UIViewTap alloc] initWithFrame:frame];
    tapView.tapDelegate = self;
    tapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    tapView.backgroundColor = [UIColor blackColor];
    [self addSubview:tapView];

    // Image view
    photoImageView = [[UIImageViewTap alloc] initWithFrame:CGRectZero];
    photoImageView.tapDelegate = self;
    photoImageView.contentMode = UIViewContentModeCenter;
    photoImageView.backgroundColor = [UIColor blackColor];
    [self addSubview:photoImageView];

    // Spinner
    spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    spinner.hidesWhenStopped = YES;
    spinner.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin |
                                UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;
    [self addSubview:spinner];

    // Setup
    self.backgroundColor = [UIColor blackColor];
    self.delegate = self;
    self.showsHorizontalScrollIndicator = NO;
    self.showsVerticalScrollIndicator = NO;
    self.decelerationRate = UIScrollViewDecelerationRateFast;
    self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

}
return self;}

- (void)setIndex:(NSUInteger)value {
if (value == NSNotFound) {

    // Release image
    photoImageView.image = nil;

} else {

    // Reset for new page at index
    index = value;

    // Display image
    [self displayImage];

}

}

// Get and display image

- (void)displayImage {
if (index != NSNotFound && photoImageView.image == nil) {

    // Reset
    self.maximumZoomScale = 1;
    self.minimumZoomScale = 1;
    self.zoomScale = 1;
    self.contentSize = CGSizeMake(0, 0);

    // Get image
    UIImage *img = [self.photoBrowser imageAtIndex:index];
    if (img) {

        // Hide spinner
        [spinner stopAnimating];

        // Set image
        photoImageView.image = img;
        photoImageView.hidden = NO;

        // Setup photo frame
        CGRect photoImageViewFrame;
        photoImageViewFrame.origin = CGPointZero;
        photoImageViewFrame.size = img.size;
        photoImageView.frame = photoImageViewFrame;
        self.contentSize = photoImageViewFrame.size;

        // Set zoom to minimum zoom
        [self setMaxMinZoomScalesForCurrentBounds];

    } else {

        // Hide image view
        photoImageView.hidden = YES;
        [spinner startAnimating];

    }
    [self setNeedsLayout];
}

}

// Image failed so just show black!

 - (void)displayImageFailure {
[spinner stopAnimating];

}

- (void)setMaxMinZoomScalesForCurrentBounds {

// Reset
self.maximumZoomScale = 1;
self.minimumZoomScale = 1;
self.zoomScale = 1;

// Bail
if (photoImageView.image == nil) return;

// Sizes
CGSize boundsSize = self.bounds.size;
CGSize imageSize = photoImageView.frame.size;

// Calculate Min
CGFloat xScale = boundsSize.width / imageSize.width;    // the scale needed to perfectly fit the image width-wise
CGFloat yScale = boundsSize.height / imageSize.height;  // the scale needed to perfectly fit the image height-wise
CGFloat minScale = MIN(xScale, yScale);                 // use minimum of these to allow the image to become fully visible

// If image is smaller than the screen then ensure we show it at
// min scale of 1
if (xScale > 1 && yScale > 1) {
    minScale = 1.0;
}

// Calculate Max
CGFloat maxScale = 2.0; // Allow double scale
// on high resolution screens we have double the pixel density, so we will be seeing every pixel if we limit the
// maximum zoom scale to 0.5.
if ([UIScreen instancesRespondToSelector:@selector(scale)]) {
    maxScale = maxScale / [[UIScreen mainScreen] scale];
}

// Set
self.maximumZoomScale = maxScale;
self.minimumZoomScale = minScale;
self.zoomScale = minScale;

// Reset position
photoImageView.frame = CGRectMake(0, 0, photoImageView.frame.size.width, photoImageView.frame.size.height);
[self setNeedsLayout];

}

- (void)layoutSubviews {

// Update tap view frame
tapView.frame = self.bounds;

// Spinner
if (!spinner.hidden) spinner.center = CGPointMake(floorf(self.bounds.size.width/2.0),
                                                  floorf(self.bounds.size.height/2.0));
// Super
[super layoutSubviews];

// Center the image as it becomes smaller than the size of the screen
CGSize boundsSize = self.bounds.size;
CGRect frameToCenter = photoImageView.frame;

// Horizontally
if (frameToCenter.size.width < boundsSize.width) {
    frameToCenter.origin.x = floorf((boundsSize.width - frameToCenter.size.width) / 2.0);
} else {
    frameToCenter.origin.x = 0;
}

// Vertically
if (frameToCenter.size.height < boundsSize.height) {
    frameToCenter.origin.y = floorf((boundsSize.height - frameToCenter.size.height) / 2.0);
} else {
    frameToCenter.origin.y = 0;
}

// Center
if (!CGRectEqualToRect(photoImageView.frame, frameToCenter))
    photoImageView.frame = frameToCenter;

}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return photoImageView;}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[photoBrowser cancelControlHiding];

}

 - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view {
[photoBrowser cancelControlHiding];

}

 - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
[photoBrowser hideControlsAfterDelay];

}

- (void)handleSingleTap:(CGPoint)touchPoint {
[photoBrowser performSelector:@selector(toggleControls) withObject:nil afterDelay:0.2];

}

- (void)handleDoubleTap:(CGPoint)touchPoint {

// Cancel any single tap handling
[NSObject cancelPreviousPerformRequestsWithTarget:photoBrowser];

// Zoom
if (self.zoomScale == self.maximumZoomScale) {

    // Zoom out
    [self setZoomScale:self.minimumZoomScale animated:YES];

} else {

    // Zoom in
    [self zoomToRect:CGRectMake(touchPoint.x, touchPoint.y, 1, 1) animated:YES];
}

// Delay controls
[photoBrowser hideControlsAfterDelay];

}

// Image View

 - (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch { [self handleSingleTap:[touch locationInView:imageView]]; }

 - (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch { [self handleDoubleTap:[touch locationInView:imageView]]; }

// Background View

- (void)view:(UIView *)view singleTapDetected:(UITouch *)touch { [self handleSingleTap:[touch locationInView:view]]; } 

 - (void)view:(UIView *)view doubleTapDetected:(UITouch *)touch {
    [self handleDoubleTap:[touch locationInView:view]]; }
  • 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-23T23:12:11+00:00Added an answer on May 23, 2026 at 11:12 pm

    You can do this task this way. When you add image to scrollView add a transparent button over imageView and then from the button’s action get the URL of that particular image from your array or somewhere else where you have stored and then using HTTPRequest upload the image.

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

Sidebar

Related Questions

I have two apps, both of which force the user to use the iPhone
I have several iPhone apps, which i want to convert them to iPad. Is
Background: I have an iPhone application for which I want the launch image to
i have two iphone apps and want to they able to switch via a
I have seen some iPhone apps in which they show first section of rows
Note: I have given up on compiling iPhone Apps without a developer certificate for
everyone seems interested in building IPhone apps today. Do you have to have an
I am new to using the SQLite database in iphone apps. I have created
What kind of audio files are you using in your iPhone games/apps? I have
I have found the Getting Started documents for developing apps on iPhone. I wanted

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.