I'm trying to get the split view controller working properly but apparently there's a bug in there or I'm missing something.
First of all, I've started a blank OSX Obj-C application, and in the Storyboard I've dragged the split view controller. Next, I've linked the segues from the main window controller to the split view and added two labels.
http://i.imgur.com/dlFObaF.png
When I build the project, it shows only the second page. Not to mention strange window size in the final build.
http://i.stack.imgur.com/IqRqr.png
I've tried everything.
This occurs in both vertical and horizontal split view.
Any suggestions?
I had the same issue myself today, but it's just the split line wasn't initiated properly.
To see, this, once you run your app, move your mouse toward the edge of the window and drag it, you will now see another view emerging.
To my best knowledge, I do not know how to fix this in IB or in code. Apparently NSSplitViewController does not have a property like UISplitViewControllerAutomaticDimension. Would appreciate if someone can contribute to this.
Edited: Found an answer via another thread. Basically, try to add some constraints to the subviews inside each view and that should prevent the size of a view to be zero. In my toy example, adding margin constraints to my buttons worked out well.
Related
I have never used NSScrollView, but looking at the tutorials, I thought It should be easy to figure out.
However, It turns out to be not intuitive at all. I pulled a ScrollView. It did not have any scrollers, though I have then enabled. No place to set ContentArea or of some sort. And. it has a clipview inside it and that clip view has another view inside. You can only add a view inside that third View.
So I thought of adding an Image view inside and it doesn't work at all. When I run, it doesn't show up. Nothing.
What am I doing wrong?
Here is the DropBox Link to project
You need 2 steps.
Fist you should position you view towards left top corner of clip view. Add 2 constraints as shown on the picture:
Then make sure you picture expands to parent view but set priority to 750 so it would not expand entire window:
Then it will look correct:
Here is your fixed project:
https://github.com/emankovski/NSScrollViewExperiment
PS: You also forgot to drag your picture to the assets catalog. I did that in the fixed project.
I am just learning Xcode. I did something that caused a view controller to turn black below the navigation bar when you build app.
It looks white in storyboard.
Also, when I pull a label onto the storyboard, it aligns to the left margin and does not show the drag boxes around it.
I may have inadvertently clicked something but when I compared it in attributes and identity inspectors line by line to another project, nothing seems amiss, i.e. everything is the default value.
Has anyone run across this?
There is not code in associated class that would cause this as it is generic i.e. plain vanilla.
Would appreciate any suggestions. Thx.
With that little information i'd say you removed the root view of the controller?
Either way, you say there is no code, so I'd suggest you simply delete that controller and create another one (bottom right, objects, viewcontroller). Since it's empty you're not gonna lose any data or time :)
Then link it to your class in the Identity Inspector and you're good to go as if it was a new one.
I have an NSSplitView inside an NSTabView. If the split view's tab is the one initially shown, it seems to work fine, but if the split view's tab is shown later instead, it appears with the first pane fully expanded and the second one collapsed. Because I want to use a thin divider for the split view, there is no way for the user to get out of this.
Returning NO from splitView:canCollapseSubview: doesn't help, even though I verified that it does get called.
As a workaround, I tried letting the split view's tab be initially shown, and then manually switching after the window is loaded (in awakeFromNib), but this did not fix it.
Is this a known issue with NSSplitView if it isn't initially shown? Is there a better way to apply the tab switching workaround? Or is there a better workaround?
I ended up getting around the issue by switching to RBSplitView. I also made a fork on GitHub to update the project to work with the latest Xcode.
I have seven views that I need to navigate between from any of the other views. I don't want to keep doing segues from each one as new instances would keep being created...among other issues. What I was originally trying to do was have all the segues start from a home view and then go to the designated target view. When the user left that target view a public variable would be set if they wanted to go to any other view other than the home view. When the home view reappeared, it would check that public variable to see if another jump was needed. In the Home view I put the segue jump check in the -(void)viewDidAppear:(BOOL)animated function. The problem with this being you see the home screen for a second before it goes off to the new target view. The -(void)viewWillAppear:(BOOL)animated does not work for segues. I guess this is because it hasn't fully released the old segue yet?
Is there a better way to handle a freeform many view navigation issue like this? If anyone needs it, I can post some sample code for what I was trying to do. Thanks in advance for any help.
It sounds like you need a UITabBarController.
It allows you to have multiple view controllers, and switch between them by tapping the tab on the bottom of the screen.
It allows you to have only one instance of each controller, so that as you switch between them, data persists and you aren't creating new instances each time.
Here is an example of what one looks like (notice the tabs at the bottom of the screen):
(source: xamarin.com)
can anyone tell me how to get my storyboard back to normal? I'm not sure what I did but all my views seem to be stretched and I can't see the navigation bars at the top of them where I need to make changes to buttons I've put up there.
full size screen Shot of Xcode
I do not know the cause, but I had this problem a while back.
In my situation I had a TabBarController pointing to several navigation controllers. To fix the problem I just deleted the TabBarController and replaced it with a new one.
If you have no TabBarController I would try just replacing the first NavigationController where the stretching takes place and it should fix all subsequent View Controllers.
The simplest solution is to roll back with your version control system.
That happened to me too. As Jeremy responses I had a tabBarController but I fixed by deleting the viewControllers associated to the tabBar, 1 of them was the one causing the problem, it was a Navigation controller wich I've changed the title, so the title was a little big and that did the controller to expand.