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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:29:36+00:00 2026-06-09T12:29:36+00:00

i am using ktphotobrowser for my app. in big image screen (ktphotoscrollviewcontroller) when i

  • 0

i am using ktphotobrowser for my app. in big image screen (ktphotoscrollviewcontroller) when i zoom image with two times tapping, the content size of scrollview (ktphotoview – it is an uiscrollview object) grows to bound.size * maximumzoomscale but my zoomed image size still smaller than contentsize of scrollview. both zoomed image size and the scrollview’s contentsize must be same so where can i do these calculation on the code?

if anybody use ktphotobrowser could help me about this problem, i will very appreciate.

i find the tap count but after this code i couldnt find where is the contentsize growing (zoom) or image growing (zoom) code

below you can find the whole code of ktphotoview.h page where the tapping count and zooming actions are coded:

#import "KTPhotoView.h"
#import "KTPhotoScrollViewController.h"
#import <QuartzCore/QuartzCore.h>

@interface KTPhotoView (KTPrivateMethods)
- (void)loadSubviewsWithFrame:(CGRect)frame;
- (BOOL)isZoomed;
- (void)toggleChromeDisplay;
@end

@implementation KTPhotoView

@synthesize scroller = scroller_;
@synthesize index = index_;



- (id)initWithFrame:(CGRect)frame
{
   self = [super initWithFrame:frame];
   if (self) {
      [self setDelegate:self];
      [self setMaximumZoomScale:2.0];
      [self setShowsHorizontalScrollIndicator:NO];
      [self setShowsVerticalScrollIndicator:NO];
      [self loadSubviewsWithFrame:frame];

        NSLog(@"scrollview2 %f",self.contentSize.height);
   }
   return self;
}

- (void)loadSubviewsWithFrame:(CGRect)frame
{
   imageView_ = [[UIImageView alloc] initWithFrame:frame];
   [imageView_ setContentMode:UIViewContentModeScaleAspectFit];
   [self addSubview:imageView_];
}

- (void)setImage:(UIImage *)newImage 
{
   [imageView_ setImage:newImage];
}

- (void)layoutSubviews 
{
   [super layoutSubviews];

   if ([self isZoomed] == NO && CGRectEqualToRect([self bounds], [imageView_ frame]) == NO) {
      [imageView_ setFrame:[self bounds]];
   }
}

- (void)toggleChromeDisplay
{
   if (scroller_) {
      [scroller_ toggleChromeDisplay];
   }
}

- (BOOL)isZoomed
{
   return !([self zoomScale] == [self minimumZoomScale]);
}

- (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center 
{

   CGRect zoomRect;

   // the zoom rect is in the content view's coordinates. 
   //    At a zoom scale of 1.0, it would be the size of the imageScrollView's bounds.
   //    As the zoom scale decreases, so more content is visible, the size of the rect grows.
   zoomRect.size.height = [self frame].size.height / scale;
   zoomRect.size.width  = [self frame].size.width  / scale;

   // choose an origin so as to get the right center.
   zoomRect.origin.x    = center.x - (zoomRect.size.width  / 2.0);
   zoomRect.origin.y    = center.y - (zoomRect.size.height / 2.0);
    NSLog(@"zoomRectHeight %f",[self frame].size.height);
   return zoomRect;
}

- (void)zoomToLocation:(CGPoint)location
{
   float newScale;
   CGRect zoomRect;
   if ([self isZoomed]) {
      zoomRect = [self bounds];

   } else {
      newScale = [self maximumZoomScale];
      zoomRect = [self zoomRectForScale:newScale withCenter:location];

   }
  // NSLog(@"zoomRectHeight %f",location.);
   [self zoomToRect:zoomRect animated:YES];
}

- (void)turnOffZoom
{
   if ([self isZoomed]) {
      [self zoomToLocation:CGPointZero];
   }
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
   UITouch *touch = [touches anyObject];

   if ([touch view] == self) {
      if ([touch tapCount] == 2) {
         [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(toggleChromeDisplay) object:nil];
         [self zoomToLocation:[touch locationInView:self]];
      }
   }
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
   UITouch *touch = [touches anyObject];

   if ([touch view] == self) {
      if ([touch tapCount] == 1) {
         [self performSelector:@selector(toggleChromeDisplay) withObject:nil afterDelay:0.5];
      }
   }
}

#pragma mark -
#pragma mark UIScrollViewDelegate Methods

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
   UIView *viewToZoom = imageView_;
    NSLog(@"scrollview %f",self.contentSize.height);
   return viewToZoom;
}
  • 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-09T12:29:38+00:00Added an answer on June 9, 2026 at 12:29 pm

    i use the below code in ktphotoview.m file to solve my problem hope this helps:

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
    {
    UITouch *touch = [touches anyObject];
    
    if ([touch view] == self) {
      if ([touch tapCount] == 2) {
    
    
         [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(toggleChromeDisplay) object:nil];
          [self zoomToRect:[self zoomRectForScale:[self maximumZoomScale] withCenter:[touch locationInView:self]] animated:YES];
          float abc=(self.contentSize.height-(imageView_.image.size.height*320/imageView_.image.size.width*self.maximumZoomScale))/2 *-1;
    
          [self setContentInset:UIEdgeInsetsMake(abc, 0, abc, 0)];
    
    
    
    
    
      }
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using WebViewBrush I can render web page content (it's screen shot) to e.g. Rectangle
I'm using the KTPhotoBrowser library to create a photo gallery in my iPhone app.
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
I am using KTPhotoBrowser in order to display images parsed from a server. Also,
Using the opencart image manager how would I set the upload to automatically remove:
Using Xcode4.2.1, with a basic PhoneGap template based app. (I say template, but I
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using the Exiv2 library to write some exif tags to an image i'm running
Using C#, I want to show the image in the Access column but failed
Using a populated Table Type as the source for a TSQL-Merge. I want to

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.