Detecting FR/FF button event in MPMoviePlayerController UI? - button

Basically long pressing of FR(fast rewind)/FF(fast forward) causes directional scrubbing. But iPod, YouTube app detects short tapping of these buttons and uses it for navigating to previous/next tracks.
How can I archive this feature? Is this possible? Or should I go view-hierarchy hack?

I have solved this with view hierarchy hack. This is not recommended and should be avoided as much as possible. But I note here for further reference. To mark there is no accessible way currently. This hack is applied to only specific version (4.3) of iOS SDK.
Iterate all view hierarchy of -[MPMoviePlayerController view].
Find subclass of UIButton. And add target-action handler to all of them. (you can check for subclass of MPTransportButton)
In handler, you can filter by tags. Only navigation buttons are tagged. Each tag means 1 = play/pause, 2 = previous, 4 = next button.
Take care about this is just an hack. Will not be guaranteed to work or pass on AppStore.
If you have experience of rejection by this method, please comment me. It'll be very appreciated.

Related

ActivityIndicator disable controls?

I want to have an ActivityIndicator that covers all controls, so the user cant click twice on the buttons. He have to wait for the loading to finish. For example, a login page in an app.
It could be something similar to this example on iOS http://developer.xamarin.com/recipes/ios/standard_controls/popovers/display_a_loading_message/
Thanks.
I'd recommend taking a look at Allan Ritchie's ACR Xamarin Forms library (available as a NuGet package). It has a Loading indicator that displays "above" the form and prevents clicking the underlying form elements.
I haven't tried this. But I might in a couple of days. But in the meantime I can give you my idea.
There is the absolute layout which you can make use of. Create a base page which is inherited by all your content pages and in the base page create the activity indicator with absolute position above. So all other controls falls under it. You can use the isbusy flag to notify property changes so that activity indicator is displayed and when the action is over set the flag to false and which in Turn will hide the activity indicator.
I had seen a sample somewhere which I will try digging up for reference. Probably in git.
For Reference

Should I use Button or TextBlock?

I have two options. I need 48 of a certain type control; it needs to respond to clicks and taps (for touch devices).
I could use Buttons, using the TextButtonStyle, and the Click event. Or I could use TextBlock, with the Tapped event.
I reckon buttons may be more "expensive" to create. OTOH, although I believe "Tapped" is also called when the user clicks the component, this makes me a little nervous due to its nomenclature, I guess.
Another difference is that a button takes up only the width necessary, whereas a TextBlock takes everything; and I want the underlying Grid to be tappable, so the TextBlock is kind of a problem that way. Is there a property that will make it more modest like the button?
There is design guidance for Windows Store apps on when and how to use buttons at http://msdn.microsoft.com/en-US/library/windows/apps/hh465470. Based on your description and this guidance, it sounds like buttons are the way to go. Responding to click events is what they were made for, and TextBlocks add the extra issues that you describe.

QMainWindow that ignore clicks, passes them on to background windows

I'd like to create a semi-transparent information window that doesn't get in the way of the user's other activities. Any clicks on the window should just pass through as if the window wasn't there.
How would you recommend implementing such behavior? Is there an easy way to do it or do I have to follow a clumsy workaround? I'm thinking of hiding the window, re-executing the click, then making the window visible again. But this would still screw up drag'n'drop gestures.
Take a look at an enum value of Qt::WidgetAttribute: Qt::WA_TransparentForMouseEvents:
When enabled, this attribute disables the delivery of mouse events to
the widget and its children. Mouse events are delivered to other
widgets as if the widget and its children were not present in the
widget hierarchy; mouse clicks and other events effectively "pass
through" them. This attribute is disabled by default.
I did a little more research into "mouse event transparency" (didn't know the exact terminology) and I found this.
I don't think there is a general and easy approach to your problem. You will probably have to dig into the native API. Once events reach an application they are not forwarded to other applications on their own.
What do you guys think? Am I doomed to work with the native APIs of each OS?

Disable UIPageViewController when ModalViewController opened

I am totaly new to this site, but I already like it :-)
I found it by searching for a question about the UIPageViewController.
I have a normal UIPageViewController App, in which I open a ModalViewController for setting up some settings...
Now the Problem: :-)
If I click on the done Button on the right side of the ModalView, to dismiss it, the PageViewController turnes the page, because he thinks that he is meant by that click ;-)
Can I disable the PageViewController GestureRecognizer as long as I have a ModalView opened?
Is there a method to disable and later his recognizer?
thank you for your help in advance...
cu Matze
It seems odd that your UIPageViewController would steal touches from a modal view presented over it. Unless, perhaps, you are embedding the modal view within the content of the UIPageViewController?
To answer your question -- you can easily disable the page view controller's gesture recognizers by enumerating its gestureRecognizers property (an NSArray):
for (UIGestureRecognizer *gr in [self.pageViewController gestureRecognizers]) {
[gr setEnabled:NO];
}
Re-enable them later with setEnabled:YES.
UPDATE:
In iOS 6 UIPageViewControllerTransitionStyleScroll has been added. UIPageViewControllers that use this transition style return no gesture recognisers in the array returned by gestureRecognizers. Presumably page view controllers with this transition style use an underlying, private UIScrollView instance (it behaves just like a UIScrollView with paging enabled), although I haven't checked this.

iOS Advanced Gestures: Getting Swipe Direction Vector

Looking through the documentation, it seems that the new advanced gestures API doesn't determine the direction of a swipe beyond the basic { left, right, up, down }.
I need the start point of the swipe and the direction.
Is there anyway to retrieve this other than coding my own advanced gesture library from scratch out the basic gestures?
And if this is my only option, could anyone point me to some open source code that does this?
Got it! Documentation is here, under 'Creating Custom Gesture Recognizers' at the bottom.
Basically the six gestures Apple provides all derive from UIGestureRecognizer, and you can make your own gesture recogniser in the same way.
then, inside your view's init, you hook up your recogniser. and just the act of hooking it up automatically reroutes incoming touch events.
Actually, the default behaviour is to make your recogniser an Observer of these events. Which means your view gets them as it used to, and in addition if your recogniser spots a gesture it will trigger your myCustomEventHandler method inside your view (you passed its selector when you hooked up your recogniser).
But sometimes you want to prevent the original touch events from reaching the view, and you can fiddle around in your recogniser to do that. so it's a bit misleading to think of it as an ' observer '.
There is one other scenario, where one gesture needs to eat another. Like you can't just send back a single click if your view is also primed to receive double clicks. You have to wait for the double-click recogniser to report failure. and if it is successful, you need to fail the single click -- obviously you don't want to send both back!

Resources