Farhan Arshad
Farhan Arshad

Reputation: 375

XLPagerTabStrip: Dynamically adding subviews to tab's view controllers wouldn't display except under first tab

XLPagerTabStrip: Dynamically adding subviews to tab's view controllers wouldn't display except under first tab.

Please download the project and run it to see the problem:

https://github.com/farhan101/TheProblemView

First Tab: Under View One tab you can see a spinner added dynamically

First Tab

Second Tab: Under View Two tab same spinner is added but it wouldn't show Second Tab

PS: As you can see in the source code, both view controllers are instances of the same view controller class.

Upvotes: 0

Views: 285

Answers (1)

Kamran
Kamran

Reputation: 15248

You need to use the parent view's bounds instead of frame while creating ViewToAdd.

let vu = ViewToAdd(frame: self.view.bounds, yFactor: 2.0)

Upvotes: 1

Related Questions