Disable UIPageViewController when ModalViewController opened - xcode4

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.

Related

Have problem to get touch or mouseclick trigger the click event of aframe objects

I can't get my code to work to trigger a function upon a click event. Both on desktop or mobile chrome browser it doesn't work. If I enter to inspector mode I recognize that in a small area of the object I can click it and it will triggered, but if I leave the inspector (strg+alt+i) it doesn't work. it seems to me that something will not hit the right point to trigger the event. This makes me crazy.
I hope someone could give me a good hint to solve my problem. thanks in advance.
My code is online testable under https://glitch.com/~ede21-arjslocationtutorial
I did not try to edit the code but I think the problem comes from your cursor and raycaster properties. They should be on a camera entity, not on the a-scene entity. A-Frame creates a default one but you can create it yourself and set this properties. The cursor will change when you hover the entities, then it should work properly ;)

Swipe to go back in navigation controller on iOS 7

I've been looking through the iOS 7 / UIKIT framework, and although it looks quite different aesthetically it's really the same SDK underneath from what I can see.
My question, is there any extra code that needs to be included to get the draggable behaviour between pushed tableviews/views?
When you push a view onto a UINavigationController you can now drag back to the previous controller from the side rather than pressing the back button.
This behavior can be seen in mail.
How is this achieved, do I need to add any code to add it to my app?
This has nothing to do with UITableView or UITableViewController, but with UINavigationController. And yes, you get this behavior for free as long as the back button is visible.

Combining a navigationcontroller and a root view controller with pages

I have a problem that has been solved on iOS6, but still appears if I use the iOS 5.1 simulator.
I have a default page based application. I added a "Main menu" view controller, that has three buttons that activate the root view controller containing the pages via a push segue, all defined in the storyboard.
I then added a navigation controller and made it the initial view controller.
If I pas the menu via a button and flip a few pages I can click the back button and it goes back to the menu. Good.
But I don't want the nav bar, so I hide it, and on the root view controller that contains the page view controllers I add a button which performs this action:
[self.navigationController popToRootViewControllerAnimated:YES];
This button works perfect on iOS6, I can flip a few pages, press the button and I'm back in the menu.
With the iOS 5.1 simulator however (and on my 5.1 iPad), a page flip occurs! It's a page filp until I'm on the last page and then I go back to the menu.
I searched for over two hours now but could not find a solution, I hope someone can help me with this?
Note: setting animated to NO does not solve the problem.
I did find the answer to my question, this is my first iOS project which explains why I did not find it any sooner myself.
In the default page based application there are two lines in the viewDidLoad method:
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
First, it's not really adding but assigning that happens here, second, when I put the second line in comment, everything works as expected.
So I'm glad it solves my problem, however it raises some questions:
The gestures are started as easy as they were, so why was this line needed in the first place, what does it supposedly fix?
Why does it work in iOS6? It should have had the same problem, no?
Is it correct that it is an assignment and not an addition?
Any answers to these three are still appreciated.
Alex

Detecting FR/FF button event in MPMoviePlayerController UI?

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.

Flex Accessiblity - Tab Focus goes out of flex app

In an accessible flex app, the user can navigate through the control by using the TAB key.
The flex app pops up on top of the html page aftert the user activate a particular link, and is loaded using swfobject.embedSWF.
It works well in most cases, but there are some instances where either or both these happen:
a) The flex app loads ok, the "flex focus" is set on the intro text label to read out loud, but pressing tab seems to still cycle through the links on the page behind. (Now Fixed, see Edit 2)
b) The focus worked well and pressing tab cycle through the controls ok, but after going through them it then tabs out of the flex app and onto the address bar.. it becomes a nightmare to even try to get back to the flex app without clicking on it.. which isn't exactly accessibility friendly.
Is there any way to prevent these from happening?
EDIT: The target browser is IE. Seems to be the most used with Jaws
EDIT: I managed to fix problem (a). The trick was to call focus on the swf object, but after a slight time out - must be something to do with flash/js ready state.
setTimeout(function(){
document.getElementById('swfobject').focus()
},25);
Problem (b) is still an issue though...
In your mx:Application component, add an event listener for the keyFocusChange and add this code :
protected function application1_keyFocusChangeHandler(event:FocusEvent):void
{
event.preventDefault();
focusManager.getNextFocusManagerComponent(event.shiftKey).setFocus();
}
b) Try to place some focusable element after swf in html. When focus leaves flex app, see if onfocus handler of that element gets called. If it is, you can refocus flex app from there or redirect it where you want.

Resources