0

I currently have a keyboard app extension with a scrollview and a variety of buttons inside the scrollview. The ScrollView is set inside a parent view. Constraints are set on the parent view to the main view top, bottom, trailing, and leading edges. The ScrollView is set to equal widths to its parent.

I'm having a major issue constraining the trailing edge of the right most button to the right hand side of the ScrollView. In devices who's width is 320 it aligns just fine, but in the larger devices the keyboard is not expanding to fill the width of the device.

I tried setting the width in viewWillLayoutSubviews but it does nothing to change the positioning of the button. Confirmed that the keyboard width = 375.

  override func viewWillLayoutSubviews() {
    var bounds = UIScreen.mainScreen().bounds
    var width = bounds.size.width
    keyboardView.frame.size.width = width
    scrollView.frame.size.width = width
    println("Keyboard Width: \(keyboardView.frame.size.width)")
    println("Scroll View: \(scrollView.frame.size.width)")    
  }
elke_wtf
  • 887
  • 1
  • 14
  • 30

0 Answers0