IB Action не вызывается из Custom View - PullRequest
0 голосов
/ 31 августа 2018

Я показываю вид, когда вид действительно появился, есть одна кнопка на виде, на которую не нажимают. Анимация работает отлично.

func checkNotificationPermission(){

        if #available(iOS 10.0, *) {

            UNUserNotificationCenter.current().getNotificationSettings { (settings) in
                if settings.authorizationStatus == .authorized{
                    print("ProfileVC permission granted for notification")
                }else{

                    DispatchQueue.main.sync {

                        self.productCollectionView.isUserInteractionEnabled = false
                        UIView.animate(withDuration: 1, delay: 3, options: [.transitionFlipFromTop, .allowUserInteraction], animations: {

                                self.notificationView.frame = CGRect(x: 16, y: (UIScreen.main.bounds.size.height - 180), width: (UIScreen.main.bounds.size.width - 32), height: 150)

                        }, completion: { (isCompleted) in

                            UIView.animate(withDuration: 1, delay: 10, options: [.transitionFlipFromTop, .allowUserInteraction], animations: {

                                    self.notificationView.frame = CGRect(x: 16, y: UIScreen.main.bounds.size.height, width: (UIScreen.main.bounds.size.width - 32), height: 150)

                            }, completion: { (isCompleted) in
                                self.productCollectionView.isUserInteractionEnabled = true
                            })
                        })
                    }
                    print("ProfileVC permission not granted for notification")
                }
            }
        }else{
            // Fallback on earlier versions
            if UIApplication.shared.isRegisteredForRemoteNotifications {
                print("ProfileVC APNS-YES")
            } else {
                print("ProfileVC APNS-NO")
            }
        }
    }

IBAction есть, связь также есть.

@IBAction func setttingButtonPressed(_ sender: UIButton) {
    print("setting button pressed")

}

Я проверил в отладчике представления, Custom View показывает верхнюю часть представления коллекции, которую вы можете увидеть в customView.

Screen shot

1 Ответ

0 голосов
/ 31 августа 2018

Проверьте isUserInteractionEnabled для просмотра, который вы добавили. Должно быть true

Вы можете отлаживать это свойство в виде самого отладчика

...