FlashAnimationToMobile icon indicating copy to clipboard operation
FlashAnimationToMobile copied to clipboard

iOS横版不适配

Open jiangbin1993 opened this issue 8 years ago • 7 comments

大神,我在用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 avatar Feb 17 '17 01:02 jiangbin1993

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

jiangbin1993 avatar Feb 17 '17 02:02 jiangbin1993

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

hardman avatar Feb 17 '17 02:02 hardman

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

hardman avatar Feb 17 '17 02:02 hardman

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

jiangbin1993 avatar Feb 17 '17 03:02 jiangbin1993

@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 avatar Feb 17 '17 03:02 jiangbin1993

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

jiangbin1993 avatar Feb 17 '17 06:02 jiangbin1993

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

303267617 avatar May 03 '17 03:05 303267617