I use an UIScrollView to set the position of a CCLayer (when i drag with the finger). It work fine but in this CCLayer i've got a CCMenu with one button CCMenuItemImage.
When i click on this button it's ok. But if i press the button and drag just a little bit the layer, the button stay pressed and become not responsive.
thanks for your help
The UIScrollView interferes with the touch events received by CCMenu. It was never designed to share its touches with a UIView.
You have these options:
find and fix the issue by modifying the CCMenu class
write your own menu class
don't use UIScrollView or disable its touch input while the menu is active
I think you'll need to modify CCMenu and attempt to disable the scroll view's ability to scroll on touch. Have a look at the UIScrollView properties called scrollEnabled and delayContentTouches.
By the time the CCMenuItem callback has been called, it might already be too late.
Related
When I'm testing my app on a mouse-driven device, I'm seeing a couple of odd highlight issues that I would like to try and resolve.
The first occurs when I call up the app bar, hover the mouse over a button (at which point the button goes grey) and then press Escape to dismiss the app bar. If I then call up the app bar again, the button has stayed grey, even if the mouse isn't over it, and remains in that state until I move the mouse over it and then away again.
I can't immediately see a property of the button that I can reset to clear that state when the app bar gets dismissed.
The other oddity I'm seeing is that sometimes the first item in the list on the page will get a box drawn around it:
This seems to happen when the app bar is being dismissed. I'm guessing that this is because the item is in a particular state that causes the box to appear but I'm not sure what state or how to clear it. The box does not appear during normal use of my app.
Thanks for any clarification or solutions you can provide.
I found a simple way to workaround this issue. In the code for Clicked/Tapped set Visibility of the button:
CreateNewDatabase.Visibility = Visibility.Collapsed;
CreateNewDatabase.Visibility = Visibility.Visible;
It will reset button state to Normal.
Hope this helps!
So, the issue is that the VisualState for the Button is being set to PointedOver, and then not being unset (because your mouse isn't leaving the bounds of the control and therefore triggering a PointerExited event). What this means is that you'll have to manually set the VisualState of the Button if you want it to change in this manner. You could do it on AppBar's Closed event. Basically, do a recursive check of all Children of the Content property of the AppBar using the VisualTreeHelper. Check to see if the Child is a Button. If it is, set its VisualState using VisualStateManager.GoToState().
I've also figured out what was causing the black box around the button - it is to indicate that the button has Focus.
The rather strange thing is that I'm not really sure why that specific button is getting focus or how a user is supposed to give focus to a button without it just randomly happening so, until I figure that out, I've decided to comment out the Focus state support from the Visual Manager XAML used in the default GridView item style.
I use a subview (UIView) with labels, text and buttons to connect to a server. Works OK. When finised and successful i need to close the subview to revert to its parent view. This happens in a delegate of the OK button of a UIAlertView, within the subview. (equivalent of Me.Close in VB.net)
Any suggestion? Could not find any docu so far.
Use UIView.RemoveFromSuperview() to remove it, see Apple doc. I would also call Dispose() on the view.
Another alternative is to use a UIViewController and PresentModalViewController(), this is generally how you show a popup view over another.
My iPhone app (based on the "Single View Application" of Xcode) has a UITextView (say: myTextView) that I want the user to be able to edit. I was setting it to editable, and all was working fine (I didn't even have to invoke becomeFirstResponder).
Then I moved it in another UIWindow (say: newWindow) (on top of the main/root/key one that is called self.window (of the Single View App.)).
But now, when I click on the UITextView, the keyboard does not show.
Everything works if I do this:
[myTextView setEditable:YES];
[myTextView becomeFirstResponder]; // ugly...and I do not need it, but I added it just in case...
[self.window addSubview:newWindow];
but the keyboard is shown immediately (since I set becomeFirstResponder) that is not nice.
But if I remove the becomeFirstResponder line, the keyboard does not show at all!
If I move the [self.window addSubview:newWindow] line above, then no matter what I do, the keyboard is not activated...
[self.window addSubview:newWindow]; // this is how it should be... but,
[myTextView setEditable:YES];
[myTextView becomeFirstResponder]; // even when I enter this, it's not working :-(
I tried [newWindow makeKeyAndVisible] nothing. I tried to add a touch delegate and detect a touch (or a gesture) on the UITextView, they work (I get the NSLog message I included), but again, no keyboard. I even tried to add another field (of the main window) on top of newWindow (so as to have a main window element on top), still no luck...
What am I missing?
You shouldn't add a UIWindow as a subview. Instead, windows are shown either by calling -[UIWindow makeKeyAndVisible], or -[UIWindow setHidden:NO] if you don't want it to receive key events.
It's rare that you need to use multiple windows though. Just using a normal UIView add adding that as a subview will do in many cases.
EDIT: I had a confusing remark before about "assigning to a screen". UIWindow has a property "screen", which you can assign to if you want to display the window on another screen than the main screen. You don't need to care about that for your use case, though.
I have an android spinner which I call via the performClick method to show a list of items (the actual control is hidden from the user and is called from a checkbox, too complex to explain why I have done it this way).
If I do not want an item in the list, how can I dismiss the popup by clicking on the black area?
Does this make sense? :/
Edit: Sorry, forgot to mention that the users will not be able to operate the bottom buttons (device is going to be galaxy tab) as they will be covered up with protective layer due as they will be outdoors.
usually such a control is dismissed using the back key in the android applications. So I would suggest that you find a way to do it the same way on your control.
'Esc' button should do the same job..
I have attached a toolbar with a UITextField and UIButton to the keyboard when it becomes the first responder via the user taping inside the textfield
textField.inputAccessoryView = theToolbar;
Problem is, the toolbar disappears when the keyboard is dismissed, thus preventing any further input.
Any ideas on how to make the toolbar go back to the bottom of the screen rather than off it completely?
I'm thinking a delegate method might help but Im really not too sure. It seems once the inputAccessoryView always the inputAccessoryView :(
Cheers
The input accessory view is automatically dismissed with the input view (the keyboard, in this case). Generally you do not want to have an input accessory view in your view hierarchy. Instead, if you want your toolbar to scroll up when the keyboard is shown, you should follow the guidelines for Managing the Keyboard.
You could try using an additional toolbar that is offscreen as the inputAccessoryView, which could "fake" the appearance of what you are trying to do. Alternatively, have you tried adding the toolbar back to the bottom of the screen using
[self.view addSubview:theToolbar];
when the keyboard reaches the bottom of the screen? You can use keyboard notifications for this.