Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS横版不适配 #7

Open
jiangbin1993 opened this issue Feb 17, 2017 · 7 comments
Open

iOS横版不适配 #7

jiangbin1993 opened this issue Feb 17, 2017 · 7 comments

Comments

@jiangbin1993
Copy link

大神,我在用iOS版的时候竖版正确,但是横版会被压扁以及下方会空出一条白块。从图层上看flashView上铺满整个屏幕的,而且安卓版是适配的。我使用了旧版和新版的都不行,新版调用了self.flashViewNew = [[FlashViewNew alloc] initWithFlashName:_animsName[10] andAnimDir:nil scaleMode:FlashViewScaleModeWidthFit designResolution:CGSizeMake(1136, 640) designScreenOrientation:FlashViewScreenOrientationHor currScreenOrientation:FlashViewScreenOrientationHor];
而且这个designResolution改为多少都是一样的效果

旧版调用的是[self.flashView setScaleMode:FlashViewScaleModeRespective andDesignResolution:CGSizeMake(1000,600)];
[self.flashView setScaleWithX:1 y:0.6 isDesignResolutionEffect:YES];
这两个方法怎么改值也不能适配横屏。 请问这该怎么修改?

@jiangbin1993
Copy link
Author

......刚才自己解决了,在横屏的时候我把设计方向改为竖屏竟然就适配了,不知道是框架写反了还是设计设计的有问题。

@hardman
Copy link
Owner

hardman commented Feb 17, 2017

😂designResolution表示美术设计时,使用的屏幕方向。

@hardman
Copy link
Owner

hardman commented Feb 17, 2017

所以对于某个动画来说designResolution应该是不变的才对。

@jiangbin1993
Copy link
Author

@hardman 回复好快啊,现在适配了 但是如果不断的播放动画,内存会越来越高,这个有什么处理方法吗?还是我哪里使用的不对?

@jiangbin1993
Copy link
Author

@hardman 下面是代码:
// 点击按钮

  • (void)portraitButtonAction:(UIButton *)button{
    NSUInteger index = button.tag - 200;

    FlashViewNew *flashViewNew = [[FlashViewNew alloc] init];
    self.flashViewNew = flashViewNew;
    _flashViewNew.animPosMask = FlashViewAnimPosMaskVerCenter | FlashViewAnimPosMaskHorCenter;
    [self.view addSubview:_flashViewNew];

    self.flashViewNew.designScreenOrientation = FlashViewScreenOrientationVer;
    self.flashViewNew.screenOrientation = FlashViewScreenOrientationVer;

    [self playAnimWithName:_portraitName[index]];
    }

// 播放动画

  • (void)playAnimWithName:(NSString *)name{
    self.flashViewNew.userInteractionEnabled = YES;
    if (!self.currAnim) {
    if (!self.flashViewNew.superview) {
    [self.view addSubview:self.flashViewNew];
    }
    if(![self.flashViewNew reload:name]){
    NSLog(@"reload error for name %@", name);
    return;
    }
    self.currAnim = name;
    }
    NSArray *anims = self.flashViewNew.animNames;
    if (anims.count == 0) {
    return;
    }
    [self.flashViewNew play:anims[self.currAnimIndex] loopTimes:self.loopTimes];

    __weak ViewController *weakCtl = self;
    __weak FlashViewNew *weakFlashView = self.flashViewNew;
    self.flashViewNew.onEventBlock = ^(FlashViewEvent evt, id data){
    if (evt == FlashViewEventStop) {
    if (weakCtl.currAnimIndex >= anims.count - 1) {
    [weakFlashView removeFromSuperview];
    weakCtl.currAnimIndex = 0;
    weakCtl.currAnim = nil;
    }else{
    weakCtl.currAnimIndex++;
    // [weakCtl clickOnAnimForTest:nil];
    }
    }
    };
    }

@jiangbin1993
Copy link
Author

原来要把动画文件放在特定的Resources->flashAnims文件夹里内存才不会持续增长

@303267617
Copy link

安卓版,在运行demo 的时候,hua在第一次显示完毕的时候会有一个小花的图片是怎么回事

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants