uigesturerecognizer

Using UIPinchGestureRecognizer to scale uiviews in single direction

。_饼干妹妹 提交于 2020-01-19 07:39:11
问题 I would like to know how we can use UIPinchGestureRecognizer to scale UIView in single (x or y) directions alone. Say, if the user moves his two fingers in a pinch gesture only in a single direction (horizontal), only the width of the uiview should increase/decrease and if the fingers are moved only vertically, the height should change. If the fingers move diagonally, then both height and width of uiview should increase/decrease. I have seen the MoveMe sample code from Apple.

Make Button touchUpInside FBLoginView

不羁的心 提交于 2020-01-16 01:12:20
问题 I have a FBLoginView with property loginButton, and I want to make a button that is not in the same view fire this FBLoginView built in button feature. Does anyone have any suggestions? thanks 回答1: Download latest facebook SDK install and import coreKit & LoginKit frameworks in target. Create one sample button and give action. Ex: [fbLogin addTarget:self action:@selector(facebookLogin:) forControlEvents:UIControlEventTouchUpInside]; #import<FBSDKCoreKit/FBSDKCoreKit.h> #import<FBSDKLoginKit

iOS/Swift: How to implement longPressed action for backButton?

≯℡__Kan透↙ 提交于 2020-01-15 08:09:58
问题 I'm trying to implement a custom back button for every ViewController in my app. I want it to have two actions. If the button gets tapped , it should behave normally and go up the navigation stack. If the button gets pressed longer it should go to a predefined ViewController. How can I achieve this for only the backbutton in swift? 回答1: You can hide your default navigation back button and add a custom button this way: import UIKit class SViewController: UIViewController { override func

UIButton touch event falls through to underlying view

我是研究僧i 提交于 2020-01-15 05:42:10
问题 I have created a small UIView which contains two UIButton s. The view responds to UITapGesture events. The Buttons are supposed to respond to TouchUpInside , however when I tap the buttons the responder is the underlying view and the tap gesture selector is triggered. Looking for advice or suggestions. 回答1: How are the views ordered in the view hierarchy? Also, are you creating the interface in IB? If you hook up the connections properly, this shouldn't be an issue at all... 回答2: You can

Begin UIPanGesture Event From A Pressed State At Time Of Instantiation

ぐ巨炮叔叔 提交于 2020-01-14 22:53:16
问题 Is there a way to begin a UIPanGestureEvent if the finger is already pressed at the time the object is instantiated? I have a situation where when a user holds their find on a screen I create a UIView under their finger. I want them to be able to drag that around and as such I have put a UIPanGestureRecognizer inside the UIView. Problem is I need to take my finger off and put it back to trigger the UIPanGestureRecognizer to start up. I need it to start from an already pressed state. Do you

Begin UIPanGesture Event From A Pressed State At Time Of Instantiation

早过忘川 提交于 2020-01-14 22:52:57
问题 Is there a way to begin a UIPanGestureEvent if the finger is already pressed at the time the object is instantiated? I have a situation where when a user holds their find on a screen I create a UIView under their finger. I want them to be able to drag that around and as such I have put a UIPanGestureRecognizer inside the UIView. Problem is I need to take my finger off and put it back to trigger the UIPanGestureRecognizer to start up. I need it to start from an already pressed state. Do you

Getting wrong UIButton tag on Long press gesture recognizer

限于喜欢 提交于 2020-01-14 14:12:25
问题 I am aware that there are already many questions asked similar to this, but I have tried all of them, and on failing to solve my issue I am posting my question. First the questions I tried are: 1)How to get button.tag via longPressGestureRecognizer? 2)UIButton Long Press Event In my application I have 12 UIButtons in my xib. On the long press of UIButton I have this method getting called. Using gesture.view.tag property always gives me same tag(i.e) every time when I click on different

Getting wrong UIButton tag on Long press gesture recognizer

谁说胖子不能爱 提交于 2020-01-14 14:09:34
问题 I am aware that there are already many questions asked similar to this, but I have tried all of them, and on failing to solve my issue I am posting my question. First the questions I tried are: 1)How to get button.tag via longPressGestureRecognizer? 2)UIButton Long Press Event In my application I have 12 UIButtons in my xib. On the long press of UIButton I have this method getting called. Using gesture.view.tag property always gives me same tag(i.e) every time when I click on different

Getting wrong UIButton tag on Long press gesture recognizer

一笑奈何 提交于 2020-01-14 14:09:28
问题 I am aware that there are already many questions asked similar to this, but I have tried all of them, and on failing to solve my issue I am posting my question. First the questions I tried are: 1)How to get button.tag via longPressGestureRecognizer? 2)UIButton Long Press Event In my application I have 12 UIButtons in my xib. On the long press of UIButton I have this method getting called. Using gesture.view.tag property always gives me same tag(i.e) every time when I click on different

How can I define the custom UIGestureRecognizer in Swift?

落花浮王杯 提交于 2020-01-14 09:54:10
问题 I want to define the custom UIGestureRecognizer in Swift, but I cannot import UIGestureRecognizerSubclass and cannot override the methods of "touchesBegan", "touchesMoved", and so on. "UIGestureRecognizerSubclass.h" is in the UIKit module, but only modules can likely be imported in Swift and header files cannot be imported. How can I import UIGestureRecognizerSubclass and define the custom UIGestureRecognizer? Edit: I added the below code in Bridging-Header.h and I successfully compiled my