0
         if (self.start.image == UIImage(named: "0005.png")) 
         { print("0005 нашлось");

    for loopAniView in 1...5 {  
         let AniView_0005 = UIImageView()
        AniView_0005.image = UIImage(named: "0005.png")
        AniView_0005.frame = CGRectMake(100, 100, 200, 200)
        self.view.addSubview(AniView_0005)

        UIView.animateWithDuration(0.8, delay: 0.2, options: [ .AllowUserInteraction], animations:
            {  
                AniView_0005.frame = CGRectMake(200, 240, 230, 230)
            }, completion: nil)

//... completion: nil) применен именно для заполнения экрана
//анимация запускается неоднократно и заполняет экран iOS в произвольном порядке
//имеется батон (button) который запускает

func refreshView() {
print("button сработал");

// что можно применить чтобы очистить экран от накопившихся изображений
// опробовано =
// self.removeAnimate()
// setNeedsDisplay()
// AniView_0005.removeAnimate()
// self.view.willRemoveSubview(Ani_0005.image)
// self.dismissViewControllerAnimated(true, completion: nil)
// exit(0) // хорошая штука...
// self.refreshView() // гонит цикл потом выдает -
// warning: could not load any Objective-C class information.
// This will significantly reduce the quality of type information available.
// self.viewDidLoad()
// self.viewWillAppear()
// self.view.layer.removeAllAnimations
// AniView_0005.layer.removeAllAnimations() // = !
// self.view.layer.removeAllAnimations()
//view.layer.transform = CATransform3DIdentity
//Ani0005.layer.sublayers?.removeAll(keepCapacity: true)
// или = ОШ или = ничего не происходит...
print("remove_started = ?")

}

1 ответ 1

0

Можно добавить tag для UIImage для опознания. И удаление:

for view in self.view.subviews {
        if view.tag == 5000 && view is UIImageView {
            view.removeFromSuperview()
        }
    }

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.