uitapgesturerecognizer

how to call @selector method from another class

五迷三道 提交于 2019-12-23 11:58:53
问题 is it possible to call @selector methods from another class ? for example i make a method "bannerTapped:" and call it from "myViewController.m" class. myviewcontroller.m : anotherClass *ac= [[anotherClass alloc]init]; UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc]initWithTarget:ac action:@selector(bannerTapped:)]; singleTap.numberOfTapsRequired = 1; singleTap.numberOfTouchesRequired = 1; cell.conversationImageView.tag = indexPath.row; [cell.conversationImageView

passing parameters to a Selector in Swift

六眼飞鱼酱① 提交于 2019-12-23 07:32:07
问题 I am building an app for keeping track of reading assignments for a university course. Each ReadingAssignment has included a Bool value that indicates if the reader has finished reading the assignment. The ReadingAssignments are collected into WeeklyAssignment arrays. I want to have the user be able to touch a label and have a checkmark appear and show the assignment as completed. I would like this touch to also update the .checked property to true so I can persist the data. So, I am trying

passing parameters to a Selector in Swift

做~自己de王妃 提交于 2019-12-23 07:31:06
问题 I am building an app for keeping track of reading assignments for a university course. Each ReadingAssignment has included a Bool value that indicates if the reader has finished reading the assignment. The ReadingAssignments are collected into WeeklyAssignment arrays. I want to have the user be able to touch a label and have a checkmark appear and show the assignment as completed. I would like this touch to also update the .checked property to true so I can persist the data. So, I am trying

Return tag of the label when it it tapped

Deadly 提交于 2019-12-23 05:07:51
问题 I have 5 labels in my view, respectively tagged 1, 2, 3, 4 and 5. I have enabled user interaction on them, and added a tap gesture. Now what I want is to get the tag of the label being touched. I am doing something like this: tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGestureSelector)]; tapGesture.numberOfTapsRequired = 1.0; - (void)tapGestureSelector :(id)sender { // I need the tag to perform different tasks. // So that I would like to get the touched

Return tag of the label when it it tapped

痴心易碎 提交于 2019-12-23 05:07:12
问题 I have 5 labels in my view, respectively tagged 1, 2, 3, 4 and 5. I have enabled user interaction on them, and added a tap gesture. Now what I want is to get the tag of the label being touched. I am doing something like this: tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGestureSelector)]; tapGesture.numberOfTapsRequired = 1.0; - (void)tapGestureSelector :(id)sender { // I need the tag to perform different tasks. // So that I would like to get the touched

Ios Swift Override double tap of UItextField

戏子无情 提交于 2019-12-23 03:04:30
问题 I want to write a custom code on double tap on UITextField and block the default text editing and popup of the keyboard. I've tried the following and nothing has worked for me so far. Kindly help me solve this problem. let gestureArray = NamTxtBoxVal.gestureRecognizers var tapGesture = UITapGestureRecognizer() for idxVar in gestureArray! { if let tapVar = idxVar as? UITapGestureRecognizer { if tapVar.numberOfTapsRequired == 2 { tapGesture = tapVar NamTxtBoxVal.removeGestureRecognizer

UITapGestureRecognizer on UITextField no longer works in IOS 7.1

喜欢而已 提交于 2019-12-22 06:36:00
问题 I have a UITapGestureRecognizer attached to a UITextField to get a "drop down" like effect. When the UITextField is tapped, I present a UIPopover with the content. This worked like a charm pre 7.1 - Now the UITextField just becomes first responder, and the gesturerecognizer is totally ignored. Tried setting delaysTouchedBegan to YES but it didn't help.Any help? 回答1: Why to use UITapGestureRecognizer , better to use UITextFieldDelegate methods - (BOOL)textViewShouldBeginEditing:(UITextView *

UIPageViewController Traps All UITapGestureRecognizer Events

时光总嘲笑我的痴心妄想 提交于 2019-12-21 16:58:38
问题 It's been a long day at the keyboard so I'm reaching out :-) I have a UIPageViewController in a typical implementation that basically follows Apple's standard template. I am trying to add an overlay that will allow the user to do things like touch a button to jump to certain pages or dismiss the view controller to go to another part of the app. My problem is that the UIPageViewController is trapping all events from my overlay subview and I am struggling to find a workable solution. Here's

Passing arguments to #selector method in swift [duplicate]

孤人 提交于 2019-12-21 16:44:28
问题 This question already has answers here : Pass extra argument for UItapgestureRecognizer with selector (3 answers) Closed 3 years ago . I want to pass multiple argument to a function while I click an image. Here is my code var param1 = 120 var param2 = "hello" var param3 = "world" let image: UIImage = UIImage(named: "imageName")! bgImage = UIImageView(image: image) let singleTap = UITapGestureRecognizer(target: self, action:#selector(WelcomeViewController.tapDetected(_:secondParam:thirdParam:)

Make a UIView draggable with the finger

蓝咒 提交于 2019-12-21 01:15:06
问题 I have the mainViewController but I have an small UIView inside that is activated when you tap a MKAnnotationView in the MKMapKit , so I need that UIView to be draggable in any part of the screen. An example screenshot of my app: The circle is an example of point, I suppose I can drag for any point of the "small" UIView. I tried using UITapGestureRecognizer but it didn't worked as my code was not good enough and I could not made it draggable because it's only the tap, not tap and move. I hope