- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的场景转换之间,丑陋的黑色背景短暂出现。有人告诉我,删除动画和延迟可以防止这种情况发生,但这并没有奏效。
它只会影响测验问题之间的转换 - 应用中的其他页面都可以。这些问题的 json 文件是后端。
这里是题目展示engine.m的动画代码
-(void)attachDelegate:(id<QuestionViewControllerDelegate>)delegate{
self.questionController1.delegate = delegate;
self.questionController2.delegate = delegate;
}
-(BOOL)showNextQuestion:(NSArray*)questions inMainView:(UIView*)mainView{
if(self.nextIndex < questions.count){
QuestionViewController* controller = self.nextIndex % 2 == 0 ?
self.questionController1 : self.questionController2;
QuestionViewController* currentController = self.nextIndex % 2 == 1 ?
self.questionController1 : self.questionController2;
controller.question = questions[self.nextIndex];
if(self.nextIndex == 0){
[controller.view setTranslatesAutoresizingMaskIntoConstraints:NO];
[mainView addSubview:controller.view];
ConstraintsPackage* controllerPackage = [self
addConstraintsToSuperview:mainView subview:controller.view];
controller.view.tag = 0;
[currentController.view
setTranslatesAutoresizingMaskIntoConstraints:NO];
[mainView addSubview:currentController.view];
ConstraintsPackage* currentControllerPackage = [self
addConstraintsToSuperview:mainView
subview:currentController.view];
currentController.view.tag = 1;
self.constraintPackages = @[controllerPackage,
currentControllerPackage];
}
[controller loadData];
[self removeController:currentController andShowController:controller
inMainView:mainView];
self.nextIndex++;
return YES;
}else{
[self.questionController1.view removeFromSuperview];
[self.questionController2.view removeFromSuperview];
return NO;
}
}
-(void)removeController:(UIViewController*)fromViewController
andShowController:(UIViewController*)toViewController inMainView:
(UIView*)mainView{
NSTimeInterval duration = 0.3;
ConstraintsPackage* fromPackage = (ConstraintsPackage*)self.constraintPackages[fromViewController.view.tag];
ConstraintsPackage* toPackage = (ConstraintsPackage*)self.constraintPackages[toViewController.view.tag];
CGFloat toValue = 0;
CGFloat fromValue = mainView.frame.size.width;
[mainView layoutIfNeeded];
[UIView animateWithDuration:duration animations:^{
fromPackage.centerXConstraint.constant = -fromValue;
toPackage.centerXConstraint.constant = toValue;
[mainView layoutIfNeeded];
} completion:^(BOOL finished) {
fromPackage.centerXConstraint.constant = 2*mainView.frame.size.width;
}];
if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
[fromViewController viewDidAppear:YES];
[toViewController viewDidAppear:YES];
}
这是来自 dropanimationcontroller.m 的代码
@implementation DropAnimationController
-(id)init{
self = [super init];
if(self){
self.presentationDuration = 0.6;
self.dismissalDuration = 0.6;
}
return self;
}
-(NSTimeInterval)transitionDuration:
(id<UIViewControllerContextTransitioning>)transitionContext{
return self.isPresenting ? self.presentationDuration :
self.dismissalDuration;
}
-(void)animateTransition:
(id<UIViewControllerContextTransitioning>)transitionContext{
if(self.isPresenting){
[self executePresentationAnimation:transitionContext];
}
else{
[self executeDismissalAnimation:transitionContext];
}
}
-(void)executePresentationAnimation:
(id<UIViewControllerContextTransitioning>)transitionContext{
UIView* inView = [transitionContext containerView];
UIViewController* toViewController = [transitionContext
viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController* fromViewController = [transitionContext
viewControllerForKey:UITransitionContextFromViewControllerKey];
UIView* blurredView = [self getBlurredImage:fromViewController.view];
blurredView.alpha = 0.0;
[inView addSubview:blurredView];
[inView addSubview:toViewController.view];
CGPoint centerOffScreen = inView.center;
centerOffScreen.y = (-1)*inView.frame.size.height;
toViewController.view.center = centerOffScreen;
[UIView animateWithDuration:self.presentationDuration delay:0.0f
usingSpringWithDamping:0.4f initialSpringVelocity:6.0f
options:UIViewAnimationOptionCurveEaseIn animations:^{
toViewController.view.center = inView.center;
fromViewController.view.alpha = 0.6;
blurredView.alpha = 1.0;
} completion:^(BOOL finished) {
[transitionContext completeTransition:YES];
}];
}
-(void)executeDismissalAnimation:
(id<UIViewControllerContextTransitioning>)transitionContext{
UIView* inView = [transitionContext containerView];
UIViewController* toViewController = [transitionContext
viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController* fromViewController = [transitionContext
viewControllerForKey:UITransitionContextFromViewControllerKey];
UIView* blurredView = [self getBlurredImage:toViewController.view];
blurredView.alpha = 1.0;
[inView addSubview:blurredView];
[inView insertSubview:toViewController.view
belowSubview:fromViewController.view];
CGPoint centerOffScreen = inView.center;
centerOffScreen.y = (-1)*inView.frame.size.height;
[UIView animateKeyframesWithDuration:self.dismissalDuration delay:0.0f
options:UIViewKeyframeAnimationOptionCalculationModeLinear animations:^{
[UIView addKeyframeWithRelativeStartTime:0 relativeDuration:0.5
animations:^{
CGPoint center = fromViewController.view.center;
center.y += 50;
fromViewController.view.center = center;
blurredView.alpha = 0.0;
}];
[UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0.5
animations:^{
fromViewController.view.center = centerOffScreen;
toViewController.view.alpha = 1.0;
}];
} completion:^(BOOL finished) {
[transitionContext completeTransition:YES];
}];
}
-(UIView*)getBlurredImage:(UIView*)view{
UIGraphicsBeginImageContext(view.frame.size);
[view drawViewHierarchyInRect:view.frame afterScreenUpdates:YES];
UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImage* blurredImage = [image applyBlurWithRadius:2.0 tintColor:[UIColor
colorWithWhite:0.0 alpha:0.4f] saturationDeltaFactor:1 maskImage:nil];
UIImageView* imageView = [[UIImageView alloc] initWithFrame:view.frame];
imageView.image = blurredImage;
return imageView;
}
@end
最佳答案
我认为它采用了窗口的背景颜色。请试试这个,它可能对你有帮助。
self.window.backgroundColor=[UIColor whiteColor];
关于ios - 动画 ios 应用程序中的黑色过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28821294/
我刚刚创建了一个带有几个表 Controller 和一个 View Controller 的 Storyboard。 一切正常,直到我的应用程序推送 View Controller :它显示为全黑。
我尝试通过添加一个名为“铀”的新元素来修改我的世界。因此,我在主包中创建了“Trauma.java”类以及下面列出的其他一些类。所有包和类: Package Explorer Trauma.java
我一直在学习如何使用 UICollection View 。我制作了一个新的 UICollectionView Controller ,并将 collectionview 单元格标识为 main.st
我想加一个超细的黑边 在这个环的边界上方和下方。 http://jsfiddle.net/PUBqA/5/ 目标是让这个戒指容易看 在白色背景上。 唯一的方法就是添加一些薄的 环外环内黑色边框。 这是
假设我有以下 python 文件 exclude_from_black.py在我的项目的根目录中: print('I want single quotes') 我试图从黑色重新格式化中排除此文件,但以
我的 Canvas 有问题。比方说,1/10 的时候我在 chrome 上有黑色方 block 而不是我的图像。我的代码如下,我该如何修改它以避免这种黑色显示? var canvas = docu
我正在尝试使用图案作为 SKScene 的背景颜色: override func didMoveToView(view: SKView) { let backgroundImage:
我正在尝试浏览一些 Collection View Swift 教程,但它们总是显示为空白/黑色页面,就好像我没有设置初始 View Controller 一样。不过,我只使用了 1 个 UIColl
我有一个标签栏应用程序。 标签栏中只有 2 个选项卡。第一个选项卡是 NavigationController,第二个选项卡是 TableViewController。第二个工作完美,但第一个则不然。
我正在通过串行端口(ttyO2)连接 BBB 和一组 arduino。我有一个数组要从 BBB 发送到一组 arduino。我需要让 BBB 发送请求并等待其中一个 arduino 的回复,但如果在一
附上图片。我能够摆脱边界上的背景区域,但图像中的背景区域仍然存在。有没有什么方法可以消除图像中的小背景区域。谢谢。 最佳答案 这个问题有一个简单的解决方法,基本思想是在 RGB 颜色空间中分割图像以过
我以前从未做过图像处理。 我现在需要检查来自相机的许多 jpeg 图像,以丢弃那些非常暗(几乎是黑色)的图像。 是否有我可以使用的免费库 (.NET)?谢谢。 最佳答案 Aforge是一个很棒的图像处
这个问题在这里已经有了答案: Background ListView becomes black when scrolling (12 个答案) 关闭 9 年前。 这是我第一次访问这个网站。我会请你
我在 iOS 上更改启动屏幕的背景颜色时遇到问题。当我第一次打开应用程序时,它会在黑色 viewcontroller 出现之前加载一个白页。如何将白色启动屏幕更改为黑色? 下面是我的应用程序的一般启动
我想检测字体的样式(粗体、粗体、黑色)。但我只能检测字体是否为粗体。 BOOL isBold = (font.fontDescriptor.symbolicTraits & UIFontDescrip
我正在尝试解决一个软件错误,在该错误中,我们认为某个应用可能不会在每次调用时都启动。为了对此进行测试,我创建了一系列计划任务来启动应用程序、截取屏幕截图,然后关闭应用程序。这些任务都是通过 .bat
完全被难住了。我已经遍地查看并实现了我能找到的每一个解决方案。我似乎无法让导航栏变得透明。 当尝试设置背景颜色时,我只在顶部看到一个黑条。就像我尝试设置背景图像一样。我已经尝试了所有这些以及所有这些变
我创建了一个 TextView ,如果文本太长,它将使其可滚动。但是,如果您单击它或将手指放在上面,它会像被单击一样变成黑色。有谁知道使它不能点击但仍然能够滚动的代码?谢谢! 在我的 xml 中定义其
我正在尝试将 DS1307 RTC 集成到 beaglebone black 上,其中我正在使用 rootfs 构建自定义内核,我使用了 beagle P9.17 和 P9.18 的 SCL 和 SD
线性渐变适用于图像,但文本不会出现在图像前景上。此外,渐变不应该出现在文本上。我哪里做错了? 任何帮助都感激不尽。 .glimage { display: flex; justify-cont
我是一名优秀的程序员,十分优秀!