How can I get the name of the [touch view] in the touchesbegan event. So if it were UIView *aaaaaview I would get aaaaaview as the return; Thank You, nonono
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
Or maybe something like this:
The
touches
parameter is a set ofUITouch
instances, which have a correspondingview
property:UIView
s don't have a specific name, but you can just check for their identity, i.e.:or use
- (BOOL)isEqual:
.You could also use the
tag
property instead to give them meaningful identities:If you really need names for some reason not mentioned in the question, you could subclass
UIView
and introduce a name property."UIView *aaaaaView" just refers to a place in memory. So if you had
and the user touched a UIView, would the view's name be "aView" or "anotherView"? In particular, a UIView has no knowledge of the name of the variable you use to store it.
I think you're going to have to initialise an NSDictionary mapping names to UIViews.
Something in your -viewDidLoad like this, perhaps:
and then in your event you can say