当从操作表中选择某个值时(我正在使用AcitonSheetPicker 3.0),我将以编程方式设置标签,而uitextview的hidden设置为false(因此我将显示该项目)。默认情况下不存在。

我想将用户的注意力吸引到新添加的标签和textview上。当然,它仍然是必填字段,但我认为简短地指出已添加它可能是更好的用户体验。

由于操作表将一直占据屏幕,直到用户从选择器中进行选择,所以事情是他们实际上不会看到该字段,因为它变得可见,所以我认为最好以某种方式对其进行动画处理。

我有什么选择可以简短地闪烁文本视图,可能是某种颜色或样式,可能会吸引人但与Apple设计保持一致?我正在使用Swift和Xcode 6,并针对ios7和8设备。

谢谢你的帮助!

最佳答案

您可以使用动画块并迭代几次闪烁。然后以最合适的方式在1或0.5秒内播放动画。

动画块:

    [UIView animateKeyframesWithDuration:0.5 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeLinear animations:^{
            for (int i=0; i<5; i++) {
                [UIView addKeyframeWithRelativeStartTime:i*0.1 relativeDuration:0.25 animations:^{
                   if (i ==0 || i == 2){
                     //set to first colour
                     self.textfield.backgroundColor = [UIColor redColor];
                   }else if(i==4){
                     //reset to white colour or default textfield colour
                     self.textfield.backgroundColor = [UIColor whiteColor];
                   }else{
                     //set to second colour
                     self.textfield.backgroundColor = [UIColor yellowColor];
                }];
            }
        }completion:nil];


苹果文档:
https://developer.apple.com/Library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html

关于swift - 将用户的注意力吸引到IOS中的UITextView,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26209013/

10-14 20:32
查看更多