ios - UIPanGestureRecognizer not accepting UIView target -


itemprop = "text">

I have a simple demo app, where I dynamically add a UIT Type Weave directly with a UIView view I am trying (as a background). But every time I compile and check the pan gesture, I get this error:

- [UIView detection pan:]: 0x17e7fc30 sent to unknown selector for example

Here is my sample code where I create UIView and assign to UIPanGesture:

  CGRect textFieldFrame = CGRectMake (0, 44, 320, 44) ; // Create a TextField UITextField * textField = [[UITextField alloc] initWithFrame: textFieldFrame]; TextField.userInteractionEnabled = NO; TextField.layer.zPosition = 100001; [Self.view addSubview: textField]; // Text Background View UIView * textBG = [[UIView alloc] initWithFrame: textFieldFrame] Create; TextBG.layer.zPosition = 100000; [Self.view addSubview: textBG]; Self.panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget: textBG Action: @Selector (Detector Page :);  

and my address PIN method:

  - (zero) finder pin: (UIPanGestureRecognizer *) GR {NSLog (@ "inside detectPan") ; }  

What are some steps I'm missing in my implementation? I swear that this exact same attitude has worked for me in the past, but now it does not work at all. Very confused!

This is a very common problem, because the word "target" has -initWithTarget: action : Try

initWithTarget: textBG to change initWithTarget: self and things should work.

Then the code of your new line will look like this:

  self.panRecognizer = [[UIPANG StarcraftAuthor] Initivith Target: Action by itself: @Selector (Find out :) ];  

The reason people are transported to the word "target" because they want to target the "object with my custom code" as the "target" (i.e. Instead, they should think about the goal of the UIPanGestureRecognizer "currently IvyView to the object on which I want to draw on the screen", or in other words "UIView which is the boss coordinator of which I Pan jess Want to be used to calculate variable translations "

like this:

 ---------------------- - | | | Containing UIView - | -----> "target" | | "Target" is the owner of x, y coordinate location. ------------ | Calculate the movements of the UIPanGestureRecognizer. | | | Your "drag" or "pan" on the screen. | UIView | | | | (Text BG). | | | | | | ------------ | | | ----------------------- 

Therefore, in your example, your app is crashing because you can target your textbg as a target , And scan as an action, which is called an apprentice, "When the pan gesture is found within the text BG object, then call the Bg object detection pin method", but you have the text There is not a scan method on BG object, you have only one TextBG mother- Find out went PIN method exists within Ita (ie "self"). This is the reason that you have been sent to Unrecognized selector for example in this situation, because your program can not find a one-nanetpan method attached to your textbg object.

Hope it helps!


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -