关于Masonry框架约束ScrollView,图片横向滚动时出现的问题,用过的大神们进来指点下
澳门新葡京官网
澳门新葡京官网
当前位置 : 澳门新葡京官网 > 现金金赌博平台

关于Masonry框架约束ScrollView,图片横向滚动时出现的问题,用过的大神们进来指点下

RT,同样的代码,在7.1版本运行完全没问题,到了8.1以上的版本就会露出了后面的scrollView,求解,先上图吧

然后是我的代码,大神们帮忙看看是哪里出了问题
@interface MainVC
@propertynonatomic,strongUIScrollView * adScrollView;
@propertynonatomic,assignNSInteger Imgnum;
@end

@implementation MainVC
- voidviewDidLoad
{
[super viewDidLoad];
self.Imgnum = 2 ;
[self createAdScrollView:self.Imgnum];
}

pragma mark - ADSCrollView

-voidcreateAdScrollView:intimageCount
{
WSmv;//#define WSweakSelf __weak __typeof&*selfweakSelf = self;
UIView * view = [[UIView alloc] init];
view.backgroundColor = [UIColor blueColor];
[self.view addSubview:view];

//创建一个View,用来装scrollView
[view mas_makeConstraints:^MASConstraintMaker *make {
    make.edges.equalTomv.view.with.insets
    UIEdgeInsetsMake130,0,mv.view.bounds.size.height/3*1-44,0;
}];

self.adScrollView = [[UIScrollView alloc] init];
self.adScrollView.bounces = NO;
self.adScrollView.showsVerticalScrollIndicator = NO;
self.adScrollView.showsHorizontalScrollIndicator = NO;
self.adScrollView.backgroundColor = [UIColor blackColor];
[view addSubview:self.adScrollView];
self.automaticallyAdjustsScrollViewInsets = YES;

//scrollView约束
[self.adScrollView mas_makeConstraints:^MASConstraintMaker *make {
    make.edges.equalToview;
}];

//scrollview里放个View
UIView *container = [[UIView alloc] init];
[self.adScrollView addSubview:container];
[container mas_makeConstraints:^MASConstraintMaker *make {
    make.edges.equalTomv.adScrollView;
    make.height.equalTomv.adScrollView;
}];
//设置imageView
[self loadImageNum:imageCount And:container];

}

//要把图片改名成ad1,ad2,ad3.....这种格式
-voidloadImageNum:intcount And:UIView * view
{
WSmv;
UIImageView *lastView = nil;
for int i = 1 ; i <= count ; ++i
{
UIImageView * subv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"ad%d",i]]];
[view addSubview:subv];

    [subv mas_makeConstraints:^MASConstraintMaker *make {
        make.top.and.bottom.equalToview;
        make.width.mas_equalTomv.view.bounds.size.width;
        make.height.mas_equalToview;

        if  lastView 
        {
            make.left.mas_equalTolastView.mas_right;
        }
        else
        {
            make.left.mas_equalToview.mas_left;
        }
    }];

    lastView = subv;
}
[view mas_makeConstraints:^MASConstraintMaker *make {
    make.right.equalTolastView.mas_right;
}];

}

结贴,忘了加这句self.automaticallyAdjustsScrollViewInsets = NO;

栏目列表

广告位

澳门新葡京官网