Got an NSOutlineView that is configured in the controller's awakeFromNib, with a datasource and autosaved expanded nodes.
All working like a charm.
The problem is that somewhere, somebody is saving the state of the scroll position, too.
This means that at launch of the app, the outline view can appear scrolled to the bottom - if that was how the user left it last (this is on Lion if it matters).
What is the best way to open the app with the outline view scrolled to the top? Preferably in awakeFromNib, or at least so the user won't be seeing a scroll movement.
I recently started having problems with my NSOutlineView being scrolled down (so that I couldn't see my elements until I scrolled up), and I used this method :
In my applicationDidLaunch: method I use this :
[outlineView scrollPoint:NSMakePoint(0.0f, [outlineView frame].size.height)];
And it seems to work. (I also had the same problem on an IKImageBrowserView, and the same piece of code worked on that too)
Hope this solution suites you better ^^
What about [outlineView scrollToVisible:0]; ?
Related
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.
I created a simple scroll view that has many CCMenu nodes. The scroll is working correctly as long as I don't drag the area above the menus (since it has higher priority).
So I solved this issue by registering a mouse event as follows:
[[CCEventDispatcher sharedDispatcher] addMouseDelegate:self priority:INT_MIN+1];
The scrolling works with this fix but the CCMenu selectors are never fired since the scroller has a higher priority.
How can I solve this issue by getting the layer to always detect mouse events as well as CCMenu items working with tapping only (i don't want them to work on dragging)?
Please note that I am working on OSX and cocos2d 2.0.
The 'temporary' solution that worked for me was changing CCMenu to CCSprite and manually check for mouse events in ccMouseUp.
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.
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 :)
Although I know of a solution to this problem, I am interested if someone can explain this solution to me. I also wanted to get this out there because I could not find any mention of this problem online, and it took me several hours over several days to track down. I have an NSTableView behaving strangely regarding redraws and its selection. The problem looks like this:
Table contents fades in, instead of appearing instantly upon it's appearance on screen. When scrolling through the contents, the newly appearing rows also fade in. When you make a selection (single or multiple), and scroll it off screen, then make another selection (that should replace, not add-to first selection), the first selection does not get cleared properly. If you scroll back to it, it is still there, in addition to your new selection. This is a display-update problem, not selection problem - i.e. your new selection is valid, it is just displayed wrong.
I tracked this through the NSArrayController I was binding to, the underlying Array, sorting, all the connections, and settings, etc., but all that has nothing to do with it.
What solved the problem was:
In the View Effects (right-most) Inspector, uncheck "Core Animation Layer" for the Window's main view.
Can anyone explain what is happening here, and perhaps improve upon the solution ?
It looks like Core Animation and NSTableView aren't getting along so well. The "fading" effect is a by-product of the way core animation works. When you have core animation in one view, it is also enabled in all of that view's subviews.
I don't recommend using core animation on the Mac unless absolutely necessary, because some interface elements (NSTextView and NSTableView, for example) aren't compatible with it. iOS has much better support for table views and such using core animation, mainly because it was designed with core animation in mind.
I know that some more simple UI elements are compatible (NSTextField and NSButton, for example).
If you absolutely need core animation in the rest of the window, put all the other views in a subview of the content view, while leaving the table view directly in the content view. You can then enable Core Animation in the other view.
Commenters, feel free to add to the list of what is and isn't compatible.