Button action not working in iphone?

后端 未结 4 1789
粉色の甜心
粉色の甜心 2021-01-27 02:33

I have an IPhone application in which i am adding a custom view inspite of a navigation bar view.i am hiding that custom view in the normal case and unhide it whenever needed.no

相关标签:
4条回答
  • 2021-01-27 02:48

    You have to enable user interaction of curtainsView.

    Try this:

    [curtainsView setUserInteractionEnabled:YES]
    

    From Apple's UIImageView Class Reference

    New image view objects are configured to disregard user events by default. If you want to handle events in a custom subclass of UIImageView, you must explicitly change the value of the userInteractionEnabled property to YES after initializing the object.

    0 讨论(0)
  • 2021-01-27 02:48

    I dont know about your whole code why you are hiding the view but what i want to say that add your UIButton to your self.view instead of self.curtainsView.
    Just make a little change in your code.

    [self.view addSubview:curtainsView];
    [self.view addSubview:scroll];
    
    0 讨论(0)
  • 2021-01-27 02:53

    Enable user interaction of curtainsView.

    [curtainsView setUserInteractionEnabled:YES]
    
    0 讨论(0)
  • 2021-01-27 03:10

    Check the signature of the backPressed method. I tripped up at first not realizing that @selector(backpressed:) looks for:

    -(void)backPressed:(id)sender { // the colon indicates the first argument
    

    If your signature does not have a sender argument, you will either need to add one or drop the colon in the @selector. Ie:

    -(void)backPressed
    
    0 讨论(0)
提交回复
热议问题