UIButton never runs code in Action

I have the following screen:

enter image description here

X is an image UIButton, I add the corresponding action to the button. But when I click on the button, it never works on the code in action.

Here is the code:

 @IBAction func CloseProfilePage(sender: AnyObject) {
        self.removeAnimate();    
    }

This is the code that is used to run the observable controller of the form:

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        let selectedAppointment = self.dayDatasource!.appointmentAtIndex(indexPath.item);
        let profilePageViewController = ProfilePageViewController.init(withAppointment: selectedAppointment);

        profilePageViewController.view.frame = self.view.frame
        self.view.addSubview(profilePageViewController.view)
        profilePageViewController.didMoveToParentViewController(self)

    }

The button is definitely associated in xib with the action:

enter image description here

When I look at the view hierarchy, there will be nothing on the button that will prevent the button, but will record clicks. I assume that imageView UIButtoncan be clicked as part of its button.

enter image description here

The X in the image is not a representation of the image that I added, it is a representation of the image that comes with UIButton. With that said, I also resorted to the following:

self.profilePageClosePopUpButton.imageView?.userInteractionEnabled = true;

. ?

+4
1

, , - , , , .

, , . , , ...

enter image description here

- , .

+3

Source: https://habr.com/ru/post/1653589/


All Articles