UI Button Connection - ios

I am unable to press the stop recording button, I feel it may have happened after I changed its size because before it was working. I checked my code and the UIbutton is still connected. I am wondering if resizing something can change the configuration for that button.

Well, the button is not supposed to be 'clickable' after the isEnabled is set to false in your viewDidLoad().
You can read more here: https://developer.apple.com/documentation/uikit/uicontrol/1618217-isenabled

You should set isEnabled to true in your viewDidLoad().

Related

ios/swift - force keyboard to stay up with uitextview?

Say I have a messaging app on an iPhone, and every time I send a message clicking the "Send" button, I don't want the keyboard to "hide", I want it to stay where it is. Is there any way to do this? I've tried using textViewShouldEndEditing to adjust it, but even when it returns false, the keyboard still hides. I've also tried using textView.becomeFirstResponder() in the textViewShouldEndEditing function, but I'm not sure where to put it. Please help, thanks!
textView.delegate = self;
-(BOOL)textViewShouldEndEditing:(UITextView *)textView{return No;}
Never mind, I got it! I put the textView.becomeFirstResponder() inside of the send button's IBOutlet instead of the textViewShouldEndEditing function.

How to make a UIButton upresponsive

I have a case where I would like to make an already existing UIButton unresponsive and basically act as a UILabel. Doesn't anyone know a way of doing this programmatically in c preferably?
Set it's .userInteractionEnabled property to false
If you disable Interaction still you can see the UIButton blinking for click. Better you can uncheck Enable button property from Accessibility.
:
This will help to achieve your requirement.
You can disable userinteraction on your button something like,
yourButton.userInteractionEnabled = NO;
And your button will not respond more!
Disbale User Intercation by writing this code:
yourButton.userinteractionenabled=NO;

UIButton disabled in IBAction re-enables itself

I have a UIButton that is linked to an IBAction in a UIView. Within this IBAction, I both change the text of the UIButton's titleLabel and disable the UIButton. However, I've found that when the action fires, the button disables itself and changes its text for a split second before re-enabling itself. It's almost like it's happening just while the button is pressed, then it undoes itself. Could someone help with this? If it's useful, I'm on the latest Xcode and iOS 8 SDK.
//this is the IBAction...it happens, but the enabled property and text change quickly undoes itself.
#IBAction func solvePuzzle(sender: AnyObject) {
self.activity.startAnimating()
self.solveButton.enabled = false
self.solveButton.titleLabel?.text = "Solving..."
}
The text of the button should not be set like that. I am not very familiar with swift, but the right method should look something like:
self.solveButton.setTitle("Solving...", forState:UIControlState.Normal);
And also make sure that the method is called on the touchUpInside action.

iOS: How to disable Fading in and out effect of UIButton

First of all, sorry for the title and asking this incredibly question but I simply couldn't figure it out. Also, since it is not related to code, I don't have code to show
I am working on an app and using iOS7 and I created a button from IB, set its background image to an image I designed. Connected it with header and set its touch up inside action as an IBAction
Yet, here is my problem. Whenever I click on the button, as an effect the image fades half transparent. I do not want this default attribute. I checked all the states on IB (highlighted, disabled, selected) and couldn't figure it out.
If I create the same button programmatically, only the text color changes, however when I set the background image, image fades (perhaps to indicate the button being pressed). How can I remove this effect?
A bit late but I believe this would solve the problem
in the xib file, set the button's type to Custom.
My button was set to system and when pressed on, it shows transparency and has a little fade in effect. Once I changed it to custom this effect is gone.
This cannot be changed once button is created. only in xib or when the button is first created.
have you tried this one yourButton.adjustsImageWhenHighlighted = NO?
If you set same background-image/background-color for every buttons states in IB (highlight, disable, selected) you will not get any fading in UIBUtton when you press it. You can set text color for every states also. If needed you can set different colors for every state and check the press action.
Hope the answered you expect. Thanks
Storyboard Solution
1:set button type to custom
2:uncheck "Highlighted adjusts Image"
If you want fading in & out effect your UIButton Type Should be a system, not custom.

Creating a custom toggle with UIButton in Interface Builder

Is this possible? It seems shoddy for it not to be.
I'm trying to create a toggle button (not a UISwitch) in IB. For example a mute button, when muted would have some indication that sound is disabled, when you hit it, that indicator disappears (but still the same underlying graphic), and toggles between these states each time it is pressed.
This functionality can be achieved using the selected property, however you can't change the Selected AND Highlighted property in IB like you can in code, so whenever the button is pressed, no matter the state, the highlighted image is the same, which looks terrible and glitchy.
Is there a way to fix this with just IB, or do I have to make a custom class to avoid manually loading in all these buttons?
Have you thought about subclassing UIButton to add in the things you need?

Resources