gdavis / FGallery-iPhone

Objective-C based gallery for iPhones
583 stars 144 forks source link

Autoresizing of imageview in scrollview (issue) #60

Closed paresh-navadiya closed 9 years ago

paresh-navadiya commented 9 years ago

ios simulator screen shot 29-dec-2014 3 00 28 am ios simulator screen shot 29-dec-2014 3 00 33 am ios simulator screen shot 29-dec-2014 3 00 37 am

paresh-navadiya commented 9 years ago

Replace below methods with new one :

  • (void)positionInnerContainer { CGRect innerContainerRect;

    innerContainerRect = CGRectMake( 0.0,0.0, _container.frame.size.width,_container.frame.size.height);

    _innerContainer.frame = innerContainerRect; }

  • (void)positionScroller { CGRect scrollerRect;

    scrollerRect = CGRectMake( 0.0,0.0, _innerContainer.frame.size.width,_innerContainer.frame.size.height-kToolbarHeight); _scroller.frame = scrollerRect; }

  • (void)positionToolbar { _toolbar.frame = CGRectMake( 0, _scroller.frame.size.height, _scroller.frame.size.width, kToolbarHeight ); }

Also replace UINavigationController (FGallery) category if using UINavigationController

@implementation UINavigationController (FGallery)

  • (BOOL)shouldAutorotate { return YES; }
  • (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll; }
  • (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { // see if the current controller in the stack is a gallery if([self.visibleViewController isKindOfClass:[FGalleryViewController class]]) { FGalleryViewController galleryController = (FGalleryViewController)self.visibleViewController; [galleryController resetImageViewZoomLevels]; } }

-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { // see if the current controller in the stack is a gallery if([self.visibleViewController isKindOfClass:[FGalleryViewController class]]) { FGalleryViewController galleryController = (FGalleryViewController)self.visibleViewController; [galleryController resetImageViewZoomLevels]; } }

sergisolanellas commented 9 years ago

@safecase123 , great answer! I had a problem with iPad and this code solve it! Many thanks!

This code should be in the main project :)