相关疑难解决方法(0)

动画按钮允许用户交互不起作用

我有一个在NSObject类中的代码中创建的UI按钮,它控制UIViewController类中的游戏.该按钮在游戏的大部分时间内都能正常工作,但在某个时刻,我希望按钮能够淡出/淡出.一旦fadein/out开始动画,按钮就不再是交互式的.我已经设置了.AllowUserInteraction选项,但仍然没有运气.我很难过这个,所以任何帮助都非常感谢!

Class GameController: NSObject {
var gameView: UIView!
var nextButton: UIButton!

func gameViewSetUp() {
    // create the nextButton
    let imageNextButton = UIImage(named: "rightArrow") as UIImage?
    self.nextButton = UIButton(type: .Custom)
    nextButton.frame = CGRectMake(ScreenWidth-100,ScreenHeight-250,60,60)
    nextButton.setTitle("", forState: UIControlState.Normal)
    nextButton.setImage(imageNextButton, forState: .Normal)
    nextButton.contentMode = .ScaleAspectFill
    nextButton.backgroundColor = UIColor.clearColor()
    nextButton.layer.cornerRadius = 5.0
    nextButton.layer.borderWidth = 2.5
    nextButton.layer.borderColor = UIColor.clearColor().CGColor
    nextButton.addTarget(self, action: "nextPressed", forControlEvents: .TouchUpInside)
    nextButton.userInteractionEnabled = true
    gameView.addSubview(nextButton)

func playStageX() { 
       nextButtonWink()
    }
}

func nextButtonWink() {
    UIView.animateWithDuration(1.5, delay: 0, options: [.AllowUserInteraction, .Repeat, .CurveEaseInOut, .Autoreverse],
        animations: …
Run Code Online (Sandbox Code Playgroud)

animation uibutton ios swift

7
推荐指数
1
解决办法
1309
查看次数

在 Swift 3 中按下单独的按钮时使标签文本“闪烁”或“闪烁”

给定一个带有屏幕文本标签和按钮的应用程序。每次按下按钮时,文本都会发生变化。我希望能够按下按钮,并且在更改文本时文本将“闪烁”,以使文本更改对用户来说更加明显。

给定以下变量:

@IBOutlet weak var text: UILabel!
@IBAction func buttons(_ sender: UIButton) {}
Run Code Online (Sandbox Code Playgroud)

我尝试过 SKAction、淡入/淡出,但所有教程/帮助都是旧版本的 Swift 中的,对我不起作用。

text button blink ios swift

2
推荐指数
1
解决办法
6380
查看次数

标签 统计

ios ×2

swift ×2

animation ×1

blink ×1

button ×1

text ×1

uibutton ×1