I have a view and five buttons in an array on a uistackview drawn on a storey board:
However, when I record, it always hit the third button and I cannot randomise which button to hit
Code is:
let app = XCUIApplication()
let oneElement = app.otherElements["First"]
let twoElement = app.otherElements["Two"]
if oneElement.exists
{
oneElement.tap()
}
if twoElement.exists
{
twoElement.tap()
}
TwoElement is the one that taps the button
How can I direct the tap to button 1 or 0?
otherelements is what was provided by the recording. I will sned the debug description in a few hours
otherElements
is what was provided by the recording. I will send the debug description in a few hours
this is what was provided by the recording. I will send the debug description in a few hours
Related
Is it possible to detect when the Today widget is expanded/contracted or 'Show More' button is tapped in Objective C?
There is no way to detect whether the Show More button has been tapped in Today Extension.
What you can do is determine if it's open with checking frame height.
You can add a boolean and set it in :
- (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize {
if (activeDisplayMode == NCWidgetDisplayModeCompact) {
//non expanded
} else {
//expanded
}
}
You can also have a layout that doesn't need to know if it's opened or closed, that's what most apps do.
Hope this helps :)
I am having real confusion with some flash banners I'm creating and making the button into a clickable object which opens a web page.
I have been using this code for a while below, which works...
on(release){
getURL("http://www.the-dude.co.uk", "_blank");
}
And I placed this code on actual button within the actions panel
However I have been told the code above is very old and that I should use action script like below...
buttonInstance.onRelease = function() {
getURL("http://www.the-dude.co.uk", "_blank");
}
So I've tried to get this method below to work but nothing happens when I click the button, and I get one error, this...
So in a nutshell I cannot get this newer code to work! Ahh
Can anyone please help me understand where I am going wrong?
I have tried placing the new code in the Scene 1 of my actions. No worky..
And I've also tried placing the code below, actually on my button within the actions panel...
this.onRelease = function() {
getURL("http://www.the-dude.co.uk", "_blank");
}
Still not working.
My scene settings are alway this...
Any help would be great thanks.
You need to place the code below on the same timeline as the instance of the button (as you tried). And the instancename of the button must be "buttonInstance".
You can set the instance name in the properties panel when the button is selected.
buttonInstance.onRelease = function() {
getURL("http://www.the-dude.co.uk", "_blank");
}
I have two buttons,if the first button is clicked two textfields will come and the second button dimension will change to next to the textfields.Now if i click the second button one textfield will appear.I did all those things.Now my question is if we click the second button,textfield will appear with what ever the dimensions we have given,but if we click the second button after clicking the first button also dimensions should change.Can any one help to do this.
Thank You
you can add multiple selectors on a single button for different control states
Your question is vaguely phrased. If I understood correctly, when the second button is pressed, you want two different actions done depending on whether the first button has previously been pressed or not. If that's the case, the solution is to define a boolean flag, which will be set to YES when the first button is pressed, and will be set to NO (if needed) after the second button's action is completed.
In your header file:
#interface yourViewController: UIViewController {
BOOL firstButtonFlag;
}
And in yourViewController.m file:
-(void)viewDidLoad {
firstButtonFlag = NO; // technically redundant line, just to show the concept
}
-(IBAction)firstButtonPressed {
firstButtonFlag = YES;
// whatever action you want done
}
-(IBAction)secondButtonPressed {
if (firstButtonFlag) {
// whatever action if first button had been pressed before
firstButtonFlag = NO; // resetting the flag for next round
}
else {
// whatever action if first button had NOT been pressed before
}
}
I need to create a custom back button for a nestedlist. In my controller I have created a listener to capture the button tap event as follows:
onCustomButtonBackTap: function(button, e, options) {
this.getMyList().setDepth(node.data.depth-1); <-- seudo code, does not work
},
My question is how can I set the current level of my nestedlist back by one each time the custom button is clicked? Also, if this approach is not correct, please let me know
Thanks is advance for your help and advice
First you need to get the current active item to set the new one... you need to use the methods in my sample code below to accomplish what you are looking for:
var newIndex = this.getMyList().getActiveItem();
this.getMyList().setActiveItem(newIndex-1);
#Jeff, thank you for your answer but I found the following method which works better in my circumstance
onCustomButtonBackTap: function(button, e, options) {
if (this.getMyList().items.indexOf(this.getMyList().getActiveItem()) > 0) {
this.getMyList().onBackTap();
}
},
There is a button at bottom right of iPad keyboard which is to hide the keypad.
How can I interact with it programmatically? (get the button then send UIControlEventTouchUpInside to it).
Does anyone know this?
[Edit]
In my case, the keyboard is shown on a modal view.
Overriding disablesAutomaticKeyboardDismissal to return NO as below allows you to dismiss the keyboard when you resignFirstResponder, even when your UITextView is on a modal view. You should put this code to your view controller, from which you initiate the keyboard:
- (BOOL)disablesAutomaticKeyboardDismissal {
return NO;
}
Source: https://stackoverflow.com/a/6268520
In general, you would send the resignFirsResponder message to the active input view.
Something like this? I can't remember where I found this code but I used it to toggle the on-screen keyboard because it would be hidden by default if a bluetooth one was connected.
- (void) toggleKeyboard(UIKeyboardImpl * keyImpl){
if (UIKeyboardAutomaticIsOnScreen()) {
UIKeyboardOrderOutAutomatic();
} else {
UIKeyboardOrderInAutomatic();
}
Edit
I found where I got this code from. It works fine but the catch is that you need to import the private framework GraphicsServices, which would most likely get your app rejected from the App store.