uitapgesturerecognizer

How recognize which UIImageview I've tapped?

允我心安 提交于 2019-12-12 03:47:14
问题 I want to realize a sort of matrix editable by touch. A series of black or white cell that if tapped switch form black to withe or viceversa. For doing this i will use UIImageView arranged in stack view a Tap Gesture Recognizer. But how do I know which UIImageView was tapped? And in which way I can change the UIImage in the UIImageView? 回答1: If they are just white and black, it would be much simpler to use a UIView and set its backgroundColor to .white or .black . You can use the tag property

How to know the sender's identifier in Swift

谁说我不能喝 提交于 2019-12-12 02:53:54
问题 I have two UILabels with two UITapGestureRecognizers in a UITableViewCell . cell.Username.tag = indexPath.row cell.SharedUser.tag = indexPath.row let tapGestureRecognizer2 = UITapGestureRecognizer(target:self, action:"GoToProfil:") let tapGestureRecognizer3 = UITapGestureRecognizer(target:self, action:"GoToProfil:") cell.Username.userInteractionEnabled = true cell.Username.addGestureRecognizer(tapGestureRecognizer2) cell.SharedUser.userInteractionEnabled = true cell.SharedUser

Including protocol function in tapGesture action selector - iOS Swift

故事扮演 提交于 2019-12-12 02:53:51
问题 I have a class (FilterBar.swift) and a viewcontroller. the viewcontroller calls the class to populate a scrollView object with list of images and each image has a tapGestureRecognizer added to it as follows: let tapGesture = UITapGestureRecognizer( target: imgView, action: Selector("filterClicked:")); tapGesture.numberOfTapsRequired = 1; tapGesture.numberOfTouchesRequired = 1; imgView.addGestureRecognizer(tapGesture); and i have a function also in FilterBar as follows: @objc func

Frontmost UIView with TapGestureRecognizer not receiving touches

我怕爱的太早我们不能终老 提交于 2019-12-12 01:25:45
问题 I'm trying to add a (background) mask view to the front most window in my iOS app. On that mask view I want to add a UITapGestureRecognizer that will dismiss the mask view. Ultimately, I want to display a popup in the middle (i.e. my mask view is a faded background for the popup), but for now I'm just having trouble getting my background to dismiss as expected. The code looks like this: I get the front most window. I create the background view and add alpha. Then I add my gesture recognizer,

How to know which pic in which tableview cell has been touched?

浪子不回头ぞ 提交于 2019-12-12 00:37:33
问题 I have custom tableViewCells in my tableView. They have 2 or more ImageViews inside the cell, which can be touched and then they will bounce and be selected. But since the cells are being reused, how do I know which ImageView in which row has been selected? I know I can get the indexPath.row, but how do I know which of the 2 or 3 Images triggered the function to give me the indexPath? Hope you guys get what I mean. Here is my custom tableViewCell, the tableView code is just kinda standard.

How to detect of tap gesture is from uiwebview or self.view?

折月煮酒 提交于 2019-12-11 19:44:10
问题 Hello everyone I have a uitapgesture on my view using the following code : UITapGestureRecognizer *tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(TAPGestureRecognizer)]; tap.numberOfTapsRequired=1; tap.delegate = self; [self.view addGestureRecognizer:tap]; - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return YES; } And I have a uiwebview as a

Get UIActionSheet to dismiss by pressing anywhere on screen

試著忘記壹切 提交于 2019-12-11 18:45:20
问题 How do i get a UIActionSheet to disapear by pressing anywhere on the screen other than the UIAction sheet. Heres the code i tried implementing thats not working currently - (void) viewDidAppear:(BOOL)animated { [paintingVIew becomeFirstResponder]; [super viewWillAppear:animated]; // or viewDidAppear? UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)]; [recognizer setNumberOfTapsRequired:1]; recognizer

Xamarin forms: GestureRecognizers not responding well to tap, need multiple taps for opening the page

孤者浪人 提交于 2019-12-11 17:11:22
问题 I have added a tap event for below UI. For image, stack layout and label I added the tap gesture event. I have done like below. <RelativeLayout Grid.Row="1"> <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="End"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="33.3*" /> <ColumnDefinition Width="33.4*" /> <ColumnDefinition Width="33.3*" /> </Grid.ColumnDefinitions> <StackLayout Grid.Column="0" HorizontalOptions="FillAndExpand" Orientation=

UITapGestureRecognizer only triggered for starting area of UIScrollView

那年仲夏 提交于 2019-12-11 13:46:41
问题 I have several sub views added to a UIScrollView in the main view controller. Each sub view's view controller has its own tap recognizer. The problem is, only tapping in the starting area on the screen is recognised. After scrolling the view and tapping beyond the starting area, the tapping handler will no longer be called. This SO post UIButton in non-visible area of UIScrollView seems to be relevant but its solution description wasn't really clear to me... A simple report project could be

Dismissing UIPickerView on tapping background

こ雲淡風輕ζ 提交于 2019-12-11 13:27:47
问题 I am adding a uipickerview as the subview of the main view. To dismiss the pickerview on tapping the backgroud view, i am adding a UITapGestureRecognizer to the main view. I am using the following code to add the GestureRecognizer for main view UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; gestureRecognizer.numberOfTapsRequired=1; gestureRecognizer.numberOfTouchesRequired=1; gestureRecognizer.delegate =