touches

Touch events on UITableView?

眉间皱痕 提交于 2019-11-30 10:26:31
问题 I have UIViewController and UITableView as child in the view, what I want to do is when I touch any row I am displaying a view at bottom. I want to hide that view if the user touch any where else then rows or the bottomView. The problem is when I click on UITableView it doesn't fires touchesEnded event. Now how can I detect touch on UITableView and distinguish it with row selection event. Thanks. 回答1: No need to subclass anything, you can add a UITapGestureRecognizer to the UITableView and

Touch events on UITableView?

六月ゝ 毕业季﹏ 提交于 2019-11-29 20:19:16
I have UIViewController and UITableView as child in the view, what I want to do is when I touch any row I am displaying a view at bottom. I want to hide that view if the user touch any where else then rows or the bottomView. The problem is when I click on UITableView it doesn't fires touchesEnded event. Now how can I detect touch on UITableView and distinguish it with row selection event. Thanks. No need to subclass anything, you can add a UITapGestureRecognizer to the UITableView and absorb the gesture or not depending on your criteria. In your viewDidLoad: UITapGestureRecognizer *tap = [

How to make UIImageView automatically resize to the size of the image loaded

瘦欲@ 提交于 2019-11-28 05:56:14
I have put an UIImageView control on my view with IB. The size of the control is just something I decided upon, pretty random size really What I want to do is the control to resize automatically whenever I set the image property to a new image. I want it to actually resize to the size of the image. Can it be done automatically ? without any code intervention ? If not - what will the best approach be in this case ? What happens today is strange. I load images into the ImageView and I see the images getting displayed properly even though the size of the ImageView is not changed. This interferes

Allow UIScrollView and its subviews to both respond to a touch

南楼画角 提交于 2019-11-27 17:44:39
I want both my UIScrollView and its subviews to receive all touch events inside the subview. Each can respond in its own way. Alternatively, if tap gestures were forwarded to subviews, all would be well. A lot of people are struggling in this general area. Here are a few of the many related questions: How does UIScrollView steal touches from its subviews How to steal touches from UIScrollView? How to Cancel Scrolling in UIScrollView Incidentally, if I override hitTest:withEvent: in the scroll view, I do see the touches as long as userInteractionEnabled is YES. But that doesn't really solve my

How to draw a transparent stroke (or anyway clear part of an image) on the iPhone

和自甴很熟 提交于 2019-11-27 10:37:34
I have a small app that allows the user to draw on the screen with the finger. I have a UIImageView where the user draws, by creating a CGContextRef and the various CG draw functions. I primarily draw strokes/lines with the function CGContextAddLineToPoint Now my issue is this: The user can draw lines of various colors. I want to give him the ability to use a "rubber" tool to delete some part of the image drawn so far, with the finger. I initially did this by using a white color for the stroke (set with the CGContextSetRGBStrokeColor function) but it didn't work out...because I discovered

Multi-touch gesture in Sprite Kit

我的梦境 提交于 2019-11-27 09:31:45
I'm working in Swift with Sprite-Kit using XCode 6, and I have many different nodes but for the moment I only manage to detect one finger and move one node at the same time. I want to know how could I manage to detect multiple fingers in order to move multiple nodes at the same time. My actual code is : var location = CGFloat() // finger position var actualNode = -1 // node touched by the finger, -1 means no node touched override func touchesBegan(touches: NSSet, withEvent event: UIEvent) // when a finger touch the screen { for touch: AnyObject in touches { location = touch.locationInNode(self

How to make UIImageView automatically resize to the size of the image loaded

天大地大妈咪最大 提交于 2019-11-27 01:08:24
问题 I have put an UIImageView control on my view with IB. The size of the control is just something I decided upon, pretty random size really What I want to do is the control to resize automatically whenever I set the image property to a new image. I want it to actually resize to the size of the image. Can it be done automatically ? without any code intervention ? If not - what will the best approach be in this case ? What happens today is strange. I load images into the ImageView and I see the

Tutorial on How to drag and drop item from UITableView to UITableView [closed]

做~自己de王妃 提交于 2019-11-26 23:38:33
I've been banging my head on this one for a while and I figured it out. I want to give back to the community since I've gotten a lot of help from this website :). I'm trying to copy an item from one UITableView to another UITableView and information I've seen on the web regarding how to do this has been sketchy at best. I figured it out on my own and so I'll describe my little architecture. Master UIView UIView with UITableView Custom UITableViewCell Custom UIView that gets copied (Person object in my case) UIView with UITableView Custom UITableViewCell Custom UIView that gets copied (Person

Allow UIScrollView and its subviews to both respond to a touch

戏子无情 提交于 2019-11-26 19:09:29
问题 I want both my UIScrollView and its subviews to receive all touch events inside the subview. Each can respond in its own way. Alternatively, if tap gestures were forwarded to subviews, all would be well. A lot of people are struggling in this general area. Here are a few of the many related questions: How does UIScrollView steal touches from its subviews How to steal touches from UIScrollView? How to Cancel Scrolling in UIScrollView Incidentally, if I override hitTest:withEvent: in the scroll

How to draw a transparent stroke (or anyway clear part of an image) on the iPhone

时光毁灭记忆、已成空白 提交于 2019-11-26 15:14:50
问题 I have a small app that allows the user to draw on the screen with the finger. I have a UIImageView where the user draws, by creating a CGContextRef and the various CG draw functions. I primarily draw strokes/lines with the function CGContextAddLineToPoint Now my issue is this: The user can draw lines of various colors. I want to give him the ability to use a "rubber" tool to delete some part of the image drawn so far, with the finger. I initially did this by using a white color for the