Tagged Questions
3
votes
2answers
52 views
How do I make elements a percentage width in Xcode
I am new to Xcode, previously developed apps as hybrid so decided to learn swift. The language itself is easy to learn, I code in many languages. But I am not understanding why Xcode doesn't let me ...
0
votes
0answers
31 views
UIButton height not being set correctly on UITableView
I have an UITableView which holds a list of items. For each UITableViewcell in that table, depending on a property from the associated object to that cell, I toggle the visibility of an UIButton by ...
0
votes
1answer
44 views
Add NSLayoutConstraint for a view inside a UITableCellView
I would like to have a UIButton centred inside my UITableCellView. I've added the necessary code in the tableView cellForRowAt function but I get the error :
The view hierarchy is not prepared for ...
1
vote
1answer
70 views
Set titleLabel according to UIButton height
I am in a situation, where i want to set the titleLabel's font-size of a UIButton element according to the height of the UIButton, so here is my setup:
let button: UIButton = {
let button = ...
1
vote
0answers
28 views
Height of view changes upon calculation?
Swift 3
I have a view with some labels in it that I'm animating into the field of view when a user taps a button. I've used this identical code in another view controller and it worked just fine. For ...
0
votes
1answer
55 views
How to concatenate UIButton along with UIText
I want to add a UIButton at the end of a sentence in UIView.
Presently I have a UILabel to display text and a button next to it. Both are subviews to UIView. I get the desired o/p if the sentence ...
1
vote
2answers
131 views
Adding constraints to a custom UIButton doesn't work
Hi I have the following code:
class MyController {
override func viewDidLoad() {
self.addButtons()
super.viewDidLoad()
}
func addButtons() {
let cancelButton ...
0
votes
1answer
40 views
UIButtons not sticking to UIView edges
Hi and thanks in advance. I'm attempting to bind two UIButtons to a UIViewController's view like so:
First by declaring them:
fileprivate var deleteButton: UIButton = UIButton(type: .system)
...
2
votes
0answers
52 views
iPad buttons near bottom of screen not detecting tap
I've a view with three buttons near the bottom of the screen. The problem is that the buttons are not tappable. If I move the buttons a little bit higher, they detect tap events.
Following are ...
0
votes
1answer
111 views
Adding UIButton To UITableView Programmatically Wrong Spot
I'm trying to get a UIButton added to a TableView, where it sits in the bottom right corner of the table view, 20 from the right edge, and 20 from the bottom. However, it ends up sticking the button ...
1
vote
0answers
38 views
Vertically align UIButton with UITextField text
I want to add a "read more"-button at the end of the textview text. The text is in a UITextView and the button is a UIButton. So first I would like to make the button align vertically with the ...
0
votes
1answer
50 views
Constraints to replace frame for UIButton
I am trying to replace a set frame with constrains for a UIButton but my code keeps crashing, what am I doing wrong?
- (void)CreateButton {
self.Button = [[UIButton alloc] init];
//self.Button.frame =...
0
votes
1answer
47 views
UIButton Constraint Failure, but works with UILabel
I am trying to add a button pragmatically to a UIView. This code will work with a UI label, but when using it with a button, the constraints fail. How can I make this work? Thanks.
let homeButton = ...
0
votes
1answer
51 views
IBOutlet for constraint and connect that to a UIButton programatically
I want a custom IBOutlet for a constraint on a UIButton so that I can modify it in a UITableViewCell. I want to change the height of the UIButton using an if/else condition.
0
votes
0answers
42 views
Can i get constraints of uibutton created through storyboard?
I want all available constraints of uibutton created through storyboard. Actually i want to modify particular constraint within uitableviewcell.
1
vote
1answer
150 views
How to restrict UIButton height using NSLayoutConstraint
I have UItoolbar in which added two items 1. UITextView and 2. UIButton.
The Property of UITextview is to autogrowing based on entered text.
While growing of height of UITextview i want to restrict ...
0
votes
0answers
209 views
UIButton not working on ipad when i add a specific constraint
When i add my button constraint of Vertical Spacing with another UILabel object, it does not work on ipad. Please have a look at attached image:
When i add SIGN UP button(highlighted with blue color) ...
0
votes
1answer
35 views
evenly spacing 4 or 5 buttons, depending on the user device
I am trying to create a user interface for both iPad and iPhone in storyboard. The iphone version has 1 button less. All buttons and helper views are pinned to the bottomLayouGuide. Also, I am using ...
0
votes
1answer
665 views
set AutoLayout from Storyboard to uiview, Uibutton not spread equally in Uiview (constraints )
enter image description hereI have set Constraints Of
first Uiview (0,0,320,530)
second uiview(0,0,320,38)
in second view there are five UIbuttons with equal size (64,38)
problem is five Uibuttons ...
1
vote
3answers
133 views
Programatically stretch UIButton width depending on condition
I've got two UIButtons into a view, which is 232px wide.
The buttons are aligned such as
|[BUTTON1][BUTTON1]|
|-------232px------|
I have a set of constraints for this alignment, but now I want to ...
0
votes
2answers
1k views
Swift Constraints Don't Take After Rotate
I am creating a UIButton programmatically in the code and am constraining it to the top and the right of the ViewController. When the ViewController loads, the UIButton is in the correct position on ...
5
votes
1answer
116 views
How to vertically center two views & divide the width equally relative to the super view?
I'm trying to align two Buttons in a View (appearing in cyan). They get aligned vertically in the View. When i try to horizontally align them, their heights get changed. I want their widths should be ...
0
votes
1answer
193 views
iOS8 NSLayoutConstraint causing issues and UIButton not clickable
Updated to XCode 6.2 with iOS 8.2, btw be prepared to suffer some serious horrible Constraint issues, and now my app UI is trashed. I didn't set constraints and and each view has about 100 UI elements ...
0
votes
0answers
99 views
Xcode - TagTextField Component: Dynamically resize superview to fit subviews
I have created a UIView with two subviews; a uibutton and uitextfield. The button is on the left of the text field and constraints determine the horizontal position for the text field automatically. ...
0
votes
1answer
102 views
Hiding View and other objects when button selected
I'm trying to hide a UIView and objects within it when a button is deselected. The button is located in a TableView section header contained in the same ViewController.
The button press is being ...
0
votes
2answers
1k views
iOS: Stack objects on top of each other using NSLayoutConstraint
I'd like to stack a few buttons on top of each other, and then show/hide them as a way to toggle. (Think a play/pause/replay button in a video player).
Is it possible to use NSLayoutConstraint to do ...
1
vote
2answers
90 views
Why is my UIButton not getting added to my cell?
In my cellForRowAtIndexPath: method I have the following code:
UIButton *signOutButton = [[UIButton alloc] init];
[signOutButton addTarget:self action:@selector(logoutButtonTapped) ...
2
votes
2answers
4k views
How to get NSLayoutConstraint programatically between UIButtons?
In a view I'm inserting a new UIButton, As I have been using AutoLayout, I need to get constraint of the view below which I'm going to insert button. How do I get the NSLayoutConstraint ...
0
votes
1answer
596 views
Instantiating and setting size of a UIButton subclass with NSLayoutConstraint
How do I set the size of a UIButton when instantiating it, ready to use for NSLayoutConstraint?
Code:
UIButtonRaisedSilver *loginButton = [UIButtonRaisedSilver buttonWithType:UIButtonTypeCustom];
[...