autolayout

Autolayout is ignored in custom TableViewCell

落爺英雄遲暮 提交于 2019-12-24 19:20:04
问题 I'm trying to constrain some objects in my tableview cell so that they will be formatted correctly and won't clip on different devices. But, whenever I add a constraint to an object in there, it throws the object off screen to the top left. In the screenshot I attached I showed it with the green bar on the left but the same is true when I do it to the other labels and text fields. Any ideas as to what I'm doing wrong? I have a near identical table view that gets its data from another source

Constraints Not Updating When Keyboard Appears

╄→гoц情女王★ 提交于 2019-12-24 18:23:04
问题 I am making a sign up screen and would like to update a few top anchors so that when the keyboard appears, the top anchor constant decreases and the keyboard doesn't cover any text fields. I have created a topConstant variable: var constraintConstant: CGFloat = 35 And have set up my views as follows: view.addSubview(passwordTextField) passwordTextField.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 25).isActive = true passwordTextField.rightAnchor.constraint(equalTo: view

MKMapView custom callOutView with auto layout iOS 6 vs. iOS7

≡放荡痞女 提交于 2019-12-24 18:09:39
问题 Hej Folks, my apps crashes on a MKMapView under iOS 6 if I use auto layout for the callout view. With iOS 7 this works fine. - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { CustomMapAnnotation *annotation = (CustomMapAnnotation *)view.annotation; if([annotation isKindOfClass:[CustomMapAnnotation class]]) { CustomMapCalloutView *calloutView = [CustomMapCalloutView new]; calloutView.translatesAutoresizingMaskIntoConstraints = NO; calloutView.titleLabel

viewDidLayoutSubviews is called when label changes (xcode) (swift)

六月ゝ 毕业季﹏ 提交于 2019-12-24 17:54:58
问题 I have a label, toggle button and an animation in my code. When I press the toggle button -> animation starts , label changes. Below is my code sample. override func viewDidLayoutSubviews() { println("viewDidLayoutSubviews is called") // Initial state of my animation. } @IBAction func Toggled(sender: AnyObject) { CallTextChange() // Two different Animations } func CallTextChange() { // Change text here} Every time I change the text in label viewDidLayoutSubviews is called. Is there a way to

Autolayout views always same size on different screen sizes

Deadly 提交于 2019-12-24 16:33:22
问题 I have a view: Can someone help me to layout these views that they all look the same on every iPhone? I mean size is dynamic and views shrink according to screen size. I have tried aspect ration and other layout options but none helped. 回答1: if you want to change the view sizes on different screens using auto layout ,you have to add the height and width constraints .then only it changes view size. Steps: open your project in xcode. goto storyboard choose Auto layout ,select your view , in

Adding constraints programmatically in UIScrollView with dynamic buttons - Swift

北战南征 提交于 2019-12-24 16:29:49
问题 I'm trying to add constraints programmatically in my ScrollView but not working. The problem is it does not work the leading and Trailing for my label and buttons. I want to put on a scroll view first one label and below the label eg 10 dynamic buttons. The code is: var buttons : [UIButton] = [] override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //Create controller and get view //var controller = UIViewController() var

Autolayout to set six square images

我与影子孤独终老i 提交于 2019-12-24 16:04:18
问题 I want to implement autolayout to set six square images that are always be in square even if screen size is changed. I have tried too many variations but fail to do so. In attached image i share sample view that autolayout will be applied. 回答1: You don't need any view wrappers or other funny business here, you can do it purely within IB or AL constraints between each item. The 'trick' is to think about the relationships between each item and to use both constants and multipliers. Each square

estimatedHeightForHeaderInSection acting weird

…衆ロ難τιáo~ 提交于 2019-12-24 16:02:12
问题 I've added a custom header to my table view and it uses dynamic type and I want it to be self sizing. So I added this to my viewDidLoad : self.tableView.sectionHeaderHeight = UITableViewAutomaticDimension And this to the rest of my table view methods: override func tableView(tableView: UITableView, estimatedHeightForHeaderInSection section: Int) -> CGFloat { return 22 } Then my header cells were way too large and not self sizing and I got this error message: Warning once only: Detected a case

iOS Autolayout keep distance from 2 views

前提是你 提交于 2019-12-24 15:47:02
问题 I'd like to have some views fixed on the top of the screen, some other on the bottom and a single fixed size view in the equal distance between the top and bottom views. I cannot figure out how to do this with Autolayout constraints. Do I need to add some spacer views to the UI, or calculate the desired position programatically? 回答1: You can do this with only one additional view. It'd look like this: stuff_on_top middle_view (with fixed size view inside) stuff_on_bottom There'd be vertical

Why do I have to set trailing space to -16 in Interface Builder to get full screen width?

寵の児 提交于 2019-12-24 15:34:50
问题 I'm building an iOS application and would like to have a menu that appears from the bottom and can be opened with an upwards swipe. Doing this programmatically works easily. Since I would also like to learn how to do this in Interface Builder I gave it a try and now Interface Builder is driving me crazy. What I did: Create a new View Controller in story boards. Add the arrow so that this controller is shown first. Add a view to the bottom of the View Controller's view. Let's call this view