IOS/Xcode: storyboard screen turning black - xcode

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.

Related

How to use NSScrollView in XCode 7+ Storyboards?

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.

Split View Controller showing only one view (Xcode 6)

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.

Prevent or change direction of animation in NCWidgetListViewController

I am trying to create a Today Widget in Swift with XCode. I started with the available example code of XCode, when you create a new Today Widget target. The content of my Today widget is loaded from an external source, and whenever a new item appears in the external source it is added to the widget on refresh (widgetPerformUpdateWithCompletionHandler).
The only thing that bugs me is that new items automatically slide in from the top, overlapping all previous items and finally reaching the final destination at the bottom of the list. How can I change this behavior to either slide in from the bottom or not at all and just appear without sliding. I think I know how I could do my own animation with ...view.animator()... but the original functionality is nowhere to be found in my code and I can't figure out how to disable it.
By now I'm pretty sure where it comes from. I assume the list items NSView is initiated with NSViewControllerTransitionOptions and the SlideDown option activated. So the animation comes from the views NSViewControllerPresentationAnimator. Unfortunately presentViewController is not called by myself. This probably is somewhere in the internals of NCWidgetListViewDelegate, which has no option to prevent or change the animation. So I guess, the only way how to "fix" this is to drop NCWidgetListViewDelegate completely and start from scratch. So the answer would be: It's not possible.

Split view divider is not showing up when subclassing from NSSplitView

I created a custom SplitView class that subclasses from NSSplitView. Everything looks right to me, and works fine, except the divider. For some reason it doesn't want to show up between my views of a SplitView.
Any kind of hint or help is highly appreciated!
here is my setup in the nib:
and here how it looks when I run it
interesting thing is, that when I move the mouse to the place where the divider should be, the cursor changes and I'm able to drag it...but for some reason it doesn't look right
You can change the color of the divider using the 'drawDividerInRect:' function to change the color of the divider by passing your own rectangle. It is also possible you moved one of the custom views in the split view and can't see the divider anymore. You could try selecting the different views using the object hierarchy.
I've found that apple doesn't like to make it easy to modify a lot of their different views and controllers, probably because they are trying to maintain some uniformity in the apps that are run on their system.
Is the hidden check box checked?

xcode two uitabbarcontrollers one page. auto-rotate issue

Summery:
I have a custom UITabBarAutoRotateController which returns YES from shouldAutorotateToInterfaceOrientation. This has no effect.
If I minimize and show the app again, the rotation issue goes away.
How do I refresh the screen so the user does not have to do this (so rotation works again)?
Details (setup graphically, so no code):
I have two UITabBarController in MainWindow.xib. I only want one to show at a time. So I am linking graphically rootViewController = tabBarController_name1. There is also tabBarController_name2.
I will also have an alert MessageBox for a user to choose what type of application they need, and it will choose a tab bar controller based on their request (per customer definition). This is commented out for now.
There is a bug with Rotation when two UITabBarControllers exist on the same xib. When I try to rotate the screen, it stays upward with wherever the main screen button (power button looking button) faces. HandleOrientationChange does not get called on the active custom ViewController being shown.
The reason I believe it's a bug is because if I hit the main screen button (minimizing the application), and click back on the application (brings it back to the foreground), rotation works perfectly!
Sorry for making you read all that mumbo :). My true question is, "Is there anyway I could refresh the main window or likewise UITabBarController's to get rotation working (without requiring the program be minimized and shown)"? A work-around, if you will?
p.s. I cannot use Storyboard for backwards compatibility reasons. The customer will be receiving this code/project. So I would like to keep this in one graphical page, rather than hiding/showing UITabBarItem's.
EDIT: two-uitabbarcontrollers-and-autorotation and uitabbarcontrollers-and-uinavigationcontrollers were both helpful, but did not address "why" this issue happens. "noob" here when it comes to xcode :)
Tab bar controller inside a navigation controller, or sharing a navigation root view is the answer. Do not use a TabBarViewController. Which, as a noob, I'm not quite sure why TabBarViewController exists (or at least isn't depreciated).
Dragging two TabBarViewControllers into the same page should result in a warning saying that you probably want to implement TabBarViewController by making a custom UIViewController and attaching a plain UITabBar to it.
Frustrating...but finally making progress :)

Resources