I was able to get this working in iOS but I am having trouble with Win 8. What I need to do is this:
I have a drawing view that is the forward most child of a ScrollViewer. When I enable drawing mode from a button in the app bar, this view becomes active. With one touch, I want the user to be able to perform the current drawing action, but with two touches I want the touches to go to the scroll view instead for scrolling and zooming. I am able to distinguish between 1 and 2 (or more) fingers, but I don't know what to do after that point.
I tried removing the manipulation mode from the drawing view so that it would not block the scroll view, but the touches continued to be swallowed by the drawing view. I also tried calling ReleasePointerCapture but that had no effect either. How can I forward touch events using the WinRT API?
For some more information, I am making use of the PointerPressed, PointerChanged, etc events in the drawing view.
Related
My app is doing a gallery which uses TouchImageView on RecyclerView.
I was trying to use this class to display multiple fullscreen images in a RecyclerView attached with PageSnapHelper
This works fine, but the zooming is very awkward to use .If I try to pinch zoom , the image moving left and right but not zooming. Only double Tap works.
I think there is a conflict with the swiping and scrolling of the RecyclerView attached with PageSnapHelper .
How can I make the TouchImageView touch events override the PageSnapHelper events when pinch zoomed byt swiping also works when swiped?
To be simple , I want the same behavior of Chat Apps(Whatsapp and telegram) Image Slider which supports both swiping and pinch zooming
Note , I searched the stackoverflow but there are only solutions for ViewPagers but no recyclerview
Im not exactly sure what you are asking here, but if I got it right, the problem is you can't pinch zoom because the RecyclerView is recognising your pinch action as a swipe.
If you wanted, you could always disallow the RecyclerView from intercepting the touch event (and handle the event yourself) by calling:
view.parent.requestDisallowInterceptTouchEvent(true)
inside the onTouch method of the PrivateOnTouchListener.
If you want a simpler solution, you could also check if the current view is zoomed or if at least 2 fingers are touching the view. If yes, disallow the parent to intercept the touch event. The inside the PrivateOnTouchListener code would then look like this:
if (isZoomed || event.pointerCount >= 2) {
v.parent.requestDisallowInterceptTouchEvent(true)
}
The parent will now only be allowed to intercept the touch event if the view isn't zoomed and if only one finger is touching the view.
I use an UIPageViewController to pan between three views.
I want to blur the background of the third view when I pan from the second to the third view (and vice versa).
Therefore I have attached an additional UIPanGestureRecognizer to the second view.
This UIPanGestureRecognizer animates the alpha-property of an image view which contains a blurred representation of the background image from 0.0 to 1.0 as soon as the right border of the second view has passed the middle of the screen. An additional UIPanGestureRecognizer of the third view does the opposite when I pan from the third to the second view.
Unfortunately this behavior is static. The panning of the UIPageViewController is interactive.
When I want to pan from the second to the third view and the right border of the second view passes the middle of the screen, the burred image view gets visible while I'm panning. But while I'm panning I can change my mind and cancel the transition when I pan back to the original position. The blurred view stays visible although the second (and not the third) view is on screen.
Similar problems occur when I pan very fast a too short distance. The UIPageViewController will move to the third view but the blurred image view stays invisible.
Is there any way to synchronize the transition of the views with the visiblity/invisibility of the burred image view?
The UIPageViewController delegate protocol has two interesting methods:
pageViewController:willTransitionToViewControllers:
pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:
Unfortunately both methods doesn't work for my purposes.
The UIViewControllerAnimatedTransitioning feature of the iOS 7 SDK also seems not to work with the UIPageViewController.
Has anyone an idea?
Sounds like iOS7 feature UIViewControllerInteractiveTransitioning (which also encompasses the associated non-interactive animated transitioning) is indeed what you need. You might consider replacing your UIPageViewController with some other mechanism that can make use of this approach, such as UINavigationController.
Does anyone know how to implement the behaviour of scrollview in iOS 6 AppStore app lists? Particularly, paging of 3,5 icons (half of icon in the right side), and when the list ends - half of the icon in the left side.
Tried so far:
1. Custom gesture recognizer (looks a bit hacky + a lot of math in the code)
2. Different configurations of scrollview and its subviews (insets, frame, content size, etc.), but it's still not working as expected
I am not 100% sure if the App Store app actually uses UIScrollView - it used to be mainly HTML based.
Regardless, you should be able to use the relatively new delegate method scrollViewWillEndDragging:withVelocity:targetContentOffset:, introduced in iOS 5. This method is designed for you to move the scroll view to a custom position once the user lifts their finger without needing to worry about deceleration / velocity (i.e, custom paging offsets). You'll need to make sure your scroll view is set not to page for this delegate method to be triggered.
Once it is triggered (when the user lifts their finger off the screen) you can calculate the required content offset and set the passed in targetContentOffset property. The scroll view will then automatically decelerate to the appropriate content offset you supplied.
I have a scrollView. Typical tableView Cell. I did things a lot on viewDidScroll.
viewDidScroll is called on 2 cases.
User scroll
Sometimes user have stop scrolling but the scrollview still scroll anyway due to momentum, bouncing, etc.
So how do I know if users are still touching the scrollView?
UIScrollView has a BOOL property named tracking that is YES while the scroll view has a touch and NO otherwise. In my testing, it is set to NO as soon as the touch ends, even if the view is decelerating (and still sending scrollViewDidScroll: to its delegate). This seems like exactly what you are asking for.
In my testing, the dragging property doesn't seem to become NO reliably while the view is decelerating after the touch ends.
The decelerating property is also unreliable in my testing. If I touch the scroll view while it is decelerating, decelerating remains YES even though the view has stopped scrolling.
The delegate's scrollViewWillBeginDragging: is called when user starts dragging and scrollViewDidEndDragging:willDecelerate: & scrollViewWillEndDragging:withVelocity:targetContentOffset:(iOS 5+ without paging enabled) is called when user lefts his/her fingers.
You may also want to check scrollViewWillBeginDecelerating: and scrollViewDidEndDecelerating:.
Ref: http://developer.apple.com/library/ios/#documentation/uikit/reference/uiscrollviewdelegate_protocol/Reference/UIScrollViewDelegate.html
how can i achieve user-resizable views like in interface builder, so that the user can adjust some images by their own
Do i have to manage all this manually with a view that watches mouse movement and so on?
You have to do all the work yourself. You will need to keep track of the objects in your view, their positions and do all the mouse tracking and view updating.
However, this is not actually very difficult, and Apple has provided a very complete example in its Sketch sample code.
I suggest drawing some buttons where you want the view to be resizable. Then start tracking mouse events in the view. Now, when a user drags its mouse while clicking on when of your spots, just change the view's frame accordingly. All of that should be possible to implement in a subclass of NSView.