0

I am new in IOS, I am using MWPhotoBrowser control first thing I want to enable the aspect filled when starting, and zooming only works on simulator not on the device, and the last thing how to hide the bottom toolbar.

Hauleth
  • 22,873
  • 4
  • 61
  • 112

2 Answers2

0

To hide the bottom bar you need to comment the code where toolbar is created in view did load method of MWPhotoBrowser which looks like this..

- (void)viewDidLoad {

    // View
    self.view.backgroundColor = [UIColor blackColor];

    // Setup paging scrolling view
    CGRect pagingScrollViewFrame = [self frameForPagingScrollView];
    _pagingScrollView = [[UIScrollView alloc] initWithFrame:pagingScrollViewFrame];
    _pagingScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    _pagingScrollView.pagingEnabled = YES;
    _pagingScrollView.delegate = self;
    _pagingScrollView.showsHorizontalScrollIndicator = NO;
    _pagingScrollView.showsVerticalScrollIndicator = NO;
    _pagingScrollView.backgroundColor = [UIColor blackColor];
    _pagingScrollView.contentSize = [self contentSizeForPagingScrollView];
    [self.view addSubview:_pagingScrollView];

    // Toolbar
    _toolbar = [[UIToolbar alloc] initWithFrame:[self frameForToolbarAtOrientation:self.interfaceOrientation]];
    _toolbar.tintColor = nil;
    if ([[UIToolbar class] respondsToSelector:@selector(appearance)]) {
        [_toolbar setBackgroundImage:nil forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
        [_toolbar setBackgroundImage:nil forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsLandscapePhone];
    }
    _toolbar.barStyle = UIBarStyleBlackTranslucent;
    _toolbar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;

    // Toolbar Items
    _previousButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"MWPhotoBrowser.bundle/images/UIBarButtonItemArrowLeft.png"] style:UIBarButtonItemStylePlain target:self action:@selector(gotoPreviousPage)];
    _nextButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"MWPhotoBrowser.bundle/images/UIBarButtonItemArrowRight.png"] style:UIBarButtonItemStylePlain target:self action:@selector(gotoNextPage)];
    _actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(actionButtonPressed:)];

    // Update
    [self reloadData];

    // Super
    [super viewDidLoad];

}

And zooming works on device too.. show me your code where and how you initializing this .. Aspect filling depends on size of your photos you are showing in it

Hardik Thakkar
  • 394
  • 5
  • 17
  • thanks it is my code `MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self]; browser.displayActionButton = YES; [browser setInitialPageIndex:initialPageIndex]; browser.wantsFullScreenLayout = YES; [self.navigationController pushViewController:browser animated:YES]; ` zooming works only on simulator @Hardik Thakkar – محمود مندور Jun 24 '13 at 15:25
0

About bottom toolbar Enough add to - (void)viewDidLoad after

_toolbar = [[UIToolbar alloc] initWithFrame:[self frameForToolbarAtOrientation:self.interfaceOrientation]];
_toolbar.alpha = 0.0;

and replace [_toolbar setAlpha:alpha];

into - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent

[_toolbar setAlpha:0.0];

As regards zooming. Write here how you make initialization MWPhotoBrowser

Mike
  • 481
  • 10
  • 24
  • it works perfectly on simulator and an iphone. maybe make clean and rebuild – Mike Jun 20 '13 at 13:06
  • the bottom bar is now hidden, but what if i want to add the action button to the top bar (navigation bar)? this is my code `MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self]; browser.displayActionButton = YES; [browser setInitialPageIndex:initialPageIndex]; browser.wantsFullScreenLayout = YES; [self.navigationController pushViewController:browser animated:YES]; ` – محمود مندور Jun 20 '13 at 13:06
  • you can add your uiview to mwphotobrowser.view above or create category MWPhotoBrowser+Utils.h when in method `- (void)viewDidLoad` write `[super viewDidLoad];` and add uinavigationbar realization there. Example: `UIView *view = [UIView new];
    view.frame = ...;
    view.alpha = 0.5;
    [browser.view addSubview:view];`
    – Mike Jun 20 '13 at 13:20
  • in first case: in method `- (void)toggleControls` you need to add `[[NSNotificationCenter defaultCenter] postNotificationName:TOGGLE_PHOTOVIEW_OVERLAYS object:nil];` and `[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(toggleBar) name:TOGGLE_PHOTOVIEW_OVERLAYS object:nil];` to place your view. – Mike Jun 20 '13 at 13:37
  • Plus method `- (void) toggleBar { [UIView animateWithDuration:1 animations:^{ if (view.alpha == 0.5) view.alpha = 0.0; else view.alpha = 0.5; }]; }` – Mike Jun 20 '13 at 13:37
  • thank you, but please i want the photo to be in aspect filled when starting and also the zoom works only on the simulator not on the device @Sauvage – محمود مندور Jun 24 '13 at 14:50
  • that is simple. `MWZoomingScrollView.m` `- (void)handleDoubleTap:(CGPoint)touchPoint` write between condition with "else". #ifndef TARGET_IPHONE_SIMULATOR and #endif. That all. – Mike Jul 04 '13 at 21:44