subinspathilettu / SJSegmentedViewController

MIT License
334 stars 126 forks source link

Funny height Issues #27

Closed hassanmah closed 7 years ago

hassanmah commented 7 years ago

Hey

I have set up the view controller as per the instructions, but I am getting some funny issues with the height.

This is my view from the debugging state. As you can see the SJSegmentedView doesn't extend to the navigation bar or to the tab bar.

subinspathilettu commented 7 years ago

Hi @hassanmah,

Could you please check in the latest version, 1.3.3? We have resolved this issue in the latest version.

hassanmah commented 7 years ago

Hi

I am using the latest version

SonnetXavier commented 7 years ago

Could you please be more precise on how you have used the SJSegmentedView, like Presented, Pushed or Added as a Child View Controller?

SonnetXavier commented 7 years ago

Hi @hassanmah , Please let us know the purpose of following line,

segmentedScrollView.segmentView?.frame.size.height = self.view.frame.size.height

Hope you are using as static library and we recommend to use as pod,

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
pod ’SJSegmentedScrollView’, ‘1.3.3'
end
hassanmah commented 7 years ago

Hi @SonnetXavier , please ignore this line, it was in error

segmentedScrollView.segmentView?.frame.size.height = self.view.frame.size.height

I am now using it as pod and still getting the same behaviour

SonnetXavier commented 7 years ago

Hi @hassanmah , We just tried out and were not able to reproduce the error. We have some queries, please answer these so that we could help you to figure out the exact issue.

  1. Is the InspirationViewController Presented or Pushed?
  2. To which type of View/View Controller is InspirationViewController being presented ?

Meanwhile, you can try out adding segmentedViewController as Child view controller. Code snippet follows:

class InspirationViewController: UIViewController {

    override func viewDidLoad() {

        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        let recipeViewController = storyboard
            .instantiateViewController(withIdentifier: "RecipeViewController")
        recipeViewController.title = "Recipe"
        let fitnessViewController = storyboard
            .instantiateViewController(withIdentifier: "FitnessViewController")
        fitnessViewController.title = "Fitness"

        let insightViewController = storyboard
            .instantiateViewController(withIdentifier: "InsightViewController")
        insightViewController.title = "Insights"

        let segmentedViewController = SJSegmentedViewController(headerViewController: nil,
                                                                segmentControllers: [recipeViewController, fitnessViewController, insightViewController]
addChildViewController(segmentedViewController)
        self.view.addSubview(segmentedViewController.view)
        segmentedViewController.view.frame = self.view.bounds
        segmentedViewController.didMove(toParentViewController: self)
          super.viewDidLoad()
    }
hassanmah commented 7 years ago

Hi @SonnetXavier , to your questions InspirationViewController is a rootviewcontroller of a navigation controller and the first view controller of a tab controller. The flow is as follows

[tab controller] >> [navigation controller] >> [InspirationViewController]

Adding segmentedViewController as Child view controller gives me the following screenshot:

SonnetXavier commented 7 years ago

Hi @hassanmah, Our team will be working on this issue. Attached is a sample project without the height issues, You could follow this and give it a try! TestHeightIssue.zip

hassanmah commented 7 years ago

@SonnetXavier still having problems. In reference to "Adding segmentedViewController as Child view controller" screenshot the space at the bottom is 50px, the exact height of the tab bar.

Could this issue be created by the tab bar?

SonnetXavier commented 7 years ago

We are not able to recreate the issue. If possible, please share your project with us.