문제

I need to implement long and short press for one button. how to go about with it. I implemented long press using longPressGestureRecognizer .. now i dont know how to do the same for short press.. its like for short press it has to load view1 and for long view2.

thank you.

도움이 되었습니까?

해결책

By short press I assume you mean a tap on the button. If you are using a nib you can connect the button action event for touch or touch up inside to an IBAction. If not you can use addTarget:action:forControlEvents detailed here:

http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIControl_Class/Reference/Reference.html#//apple_ref/occ/instm/UIControl/addTarget:action:forControlEvents:

If you decide not to use a button or not to use the UIControl methods, you can attach a UITapGestureRecognizer to the same view with a different target action.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top