Unable to embed UIScrollView over UIView in another scene using Xcode 8

I have an existing iPad app (portrait mode) where I am trying to add landscape mode to Xcode. I was able to do this on the first simple view seen below, changing the class in Xcode to UIScrollView, and UIView fell into the line below (I believe that XIV was added to UIView, but not sure if it). The scrollview function works great in landscape mode.

When I try to do the same for the next scene, this will not allow me to reorder again, as shown in the following image; I am not sure why this will not allow the same thing:

Any ideas? Is there any other way to do this?

UPDATE Here is an image showing the position of an attempt to insert a UIScrollView into a UIVIewController (Book information is a UIViewController, viewing book details is a UIView):

enter image description here

+4
source share
4 answers

None of the answers solved the problem of modifying an existing application, so I asked Apple for technical support. They also did not decide, but they gave me some documents that could be looked at. @Aragunz probably came close, suggesting that this is a problem / in Xcode 8. My only option is to rewrite the storyboard from scratch while preserving the existing classes.

+1
source

:  1. UIView UIViewController, ,  2. a UIScrollView .  3. UIView UIScrollView.

, . " ", "", UIScrollView . .

: enter image description here

+3

  • navigation bar 44px, 20px ( 20px - , , .., ).

, navigation bar , , , VC, , VC , ( , ). , navigation bar UIScrollView .

, , statusBar 20px, .

enter image description here

  1. UIScrollView ViewController :

    • top to navgationBar 0px
    • Leading, Trailing, bottom to superview 0.

VC . . , UIScrollView , .

enter image description here

  1. UIView UIScrollView ( viewMain) ,

    • , , , scrollview 0
    • viewVC. viewVC - VC. , UIViewController.

enter image description here

, .

enter image description here

  1. 5 scrollview .

  2. viewMain ( viewYellow) ;

    • top, mainView 0px
    • height 180px

enter image description here

enter image description here

  1. , step 4, (viewGreen, viewBlue, viewRed, viewPurple) ,

      • viewGreen : 1. top to viewYellow 0px 2. mainView 0px 3. height 150px.
      • viewBlue : 1. top to viewGreen 0px 2. mainView 0px 3. height 80px.
      • viewBlue : 1. top to viewGreen 0px 2. mainView 0px 3. height 80px.
      • viewRed : 1. top to viewBlue 0px 2. mainView 0px 3. height 140px.
      • viewPurple : 1. top to viewRed 0px 2. mainView 0px 3. height 128px. 4. mainView 0px.

enter image description here

enter image description here

viewPurple, UI, . scrollview, .

enter image description here

. UIViewController , , , scrollview .

:

, mainView so mainView,

mainView.height = viewYellow.top + viewYellow.height + .... for all view + viewPurple.bottom

scrollview :

scrollView.height = mainView.height

, .

enter image description here

enter image description here

enter image description here

+1

Select Book Details UIViewControllerin the storyboard, and then simply select the root mode. Delete it and then drag UIScrollViewon UIViewController. Your root view should now beUIScrollView

Note. I personally prefer the following hierarchy of views:

|---UIView
     |---UIScrollView
         |---UIView //(to act as a container)
              |---UIView
              |---UIView
              |---UIView
              |---UIView

Allows you to scale the application as needed quite easily, as well as allowing autorun to quite easily control the setting of the size of the contents of your UIScrollView

-1
source

Source: https://habr.com/ru/post/1668434/


All Articles