MWPhotoBrowser仅在模拟器上进行缩放

时间:2013-06-20 11:50:07

标签: ios objective-c mwphotobrowser

我是IOS的新手,我正在使用MWPhotoBrowser控件首先我要启动方面填充方面,并且缩放仅适用于不在设备上的模拟器,最后一件事如何隐藏底部工具栏。

2 个答案:

答案 0 :(得分:0)

要隐藏底栏,您需要在视图中注释创建工具栏的代码,并执行MWPhotoBrowser的加载方法,如下所示..

- (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];

}

缩放也适用于设备..告诉我你的代码在哪里以及如何初始化这个.. 纵横填充取决于您在其中显示的照片的大小

答案 1 :(得分:0)

关于底部工具栏

之后添加到- (void)viewDidLoad足够了
_toolbar = [[UIToolbar alloc] initWithFrame:[self frameForToolbarAtOrientation:self.interfaceOrientation]];
_toolbar.alpha = 0.0;

并替换 [_toolbar setAlpha:alpha];

进入- (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent

[_toolbar setAlpha:0.0];

关于缩放。在此处写下如何进行初始化MWPhotoBrowser