How can I remove a button from a Screen using Ruby Motion - uibutton

I can manage to remove an image
def remove_image
#button_image.removeFromSuperview
end
But what script works in order to remove a button?

A button is a subclass of a UIView so you can remove it the same way:
#button.removeFromSuperview
Alternatively, you can just hide the button:
#button.hidden = true

Related

Can't fire event when I click on Label

I'm using 7.1.0.GA, nothing happened when I click on Label, So I tried to put it inside a View, the event fire when I click around the Label but dont when I click on the area of Label.
it's probably don't receive the touch maybe your label or parent have touchEnabled false, or probably you have a view above your label add different background color for each element to find the guilty
Set touchEnabled of your Label to false and then it should work when you click on the View.

How to hide a button on an app with multiple windows? - Objective C OSX

I have an application which has a button on the first window, once pressed this button should hide and perform an action, to hide the button i'm using this code:
[self.myButton setHidden:TRUE];
This works fine until I have multiple windows - new instances of this window do not have this button it's hidden by default. However when I create a new window and press the myButton on the first window it doesn't hide the button.
Furthermore if I create a new window and then close that window and press the myButton on the first and now only window it crashes.
It's clear it always seems to target the last window created, how can I make it always target the first window created, or the window the action is actually being sent from?
New windows are simply being created by calling a newDocument from the document controller like so:
[dc newDocument:self];
Most button actions look like this:
- (void)someAction:(NSButton* sender) {}
or
func someAction(sender : NSButton) {}
As you can see, a sender is passed with the action. Now this sender is actually the button you pressed. So you can simply hide this particular button by calling sender.hidden = true;
The sender is automatically added when you use Storyboards or Xibs to add the actions.
If you add the action programmatically, add a colon after the selector (ObjC) or string (Swift). The button instance should be passed to you then.
... action:#selector(someAction:)...
or
... action:"someAction:" ...

How can I disable button press?

I'm trying to make some controls just for their view. For example I need a button which remains unpressed when it's pressed, like it seems on visual basic editor. How can I make this button?
Edit: Here is what I want
Before press:
After press:
Just a few possibilites
WinForms: yourButton.Enabled = false
WPF: yourButton.IsHitTextVisible = false
Make a image of a button and place it in your form

how to show/hide moreNavigationController when back?

My tabbar have more than 6 items,when I click [more] item,it will show other items with a tableview.
Then click the one of items,I hide the navBar use setNavigationBarHidden:YES in viewDidLoad,and I have a custom button click to back [more] use popViewControllerAnimated:YES.
When it back,the navBar still hiding,how can I show the navBar recover on [more] screen?(I need the EDIT button in [more])
Just call setNavigationBarHidden:NO animated:YES, before calling popViewControllerAnimated:YES.
I added this to viewdidAppear on my custom tabbar controller class
not the proper way to to do it but I haven't had any problems with it
tabBarController!.moreNavigationController.isNavigationBarHidden = true
tabBarController!.tabBar.isHidden = true

making a thumbnail toolbar (windowsAPICodePack,windows 7) button invisible in vb.net

I'm trying to make a thumbnail toolbar button (TTB from now on)visible when the it is clicked. I know how to do stuff when it is clicked, AddHandler etc. But if I tell it TTB.visible=false then it doesn't become invisible. If I put TTB.enabled = False it will be disabled, so it's only the visible that isn't working.
Also I put a button on my form (not a TTB) and when that is click wrote, TTB.visible = false and that didn't work, so there is no way to make it invisible.
Try set TTB.visible=true after you Add it into toolbar button list.