Permanent Misplaced View warning for Clip View in NSTableView - objective-c

My application has a log window that displays lines in an NSTableView:
When I add auto layout constraints to the window no matter what I do I get a Misplaced View warning for the Clip View:
I've tried updating its frame, updating its constraints, and resetting to suggested constraints, but nothing gets rid of the warning. The window displays and resizes correctly at runtime, and it doesn't even appear to be possible to add constraints to the Clip View itself.
I've pushed the code to github if you want to look at it in Xcode: https://github.com/MagerValp/AutoDMG/tree/e57b0140e3fc3f7f9e0d4550341ed249a6cf5378. The code requires the 10.10 SDK to compile, but the xib should be viewable in Xcode 5 and up.

I met the same issue recently, warning about Clip view expected value is 17px larger than actual value.
I believe it is a bug of Xcode. And I do find a workaround to fix it(other than downgrading my OS to 10.9).
The solution is to edit the attributes of tableView in IB, disable "Headers". Don't show table headers and the warning will be magically gone. And we can guess that by default the table header is 17px :)
It's just a workaround, not an ideal solution. This is not our fault. The best solution is to wait for Apple to fix this Xcode bug.

Scrollviews' subview hierarchy are only sort of compatible with auto layout.
One way around this is to constrain the clip view so it is not bothering you.
Then in the inspector, mark those constraints to be removed at runtime.

ScrollCiew
ClipCiew
TableView
If the error is coming from ClipView.
Check the ScrollView size, remember it.
And then click ScrollView as target, open up size inspector, enable Intrinsic Size using Placeholder with ScrollView size.

I use the Xcode 12.3, the latest version of Xcode. But also have the same warning. I remove the misplaced view warning by change the TableView Content Mode from View Based to Cell Based and then the warning disappeared. And then I change back to View Based. The warning will never appeared again.

Related

Why is my window resizing itself? (Cocoa app)

I was creating a simple GUI for an app, and came across this seemingly unusual behaviour when running.
Here is what my xib file looks like:
And here is what happens when I run the app:
I have tried creating a new view and using that instead, but it displays the same behaviour.
Why is the window getting resized? And more importantly, how can you prevent it from happening?
Thanks!
I've had this problem lately with Xcode's auto-layout feature. I solved it by manually deleting all the constraints and using the "Editor->Resolve Auto-Layout Issues->Reset to Suggested Constraints in Window.
You either need to use Auto Layout Constraints or Springs and Struts (old style ) to configure your views. The window normally will adjust itself as needed with auto layout.
With old style you have to manage the window frame or at least its content view frame.
Go to .xib file
and select size inspector. and from that set autosizing according to your rquirement.
Feel free to contact.
Increase main window width and hight.

Frame for clip view will be different at runtime error in Xcode 5 and Objective-C

I'm now building on OS X app using Xcode 5.0 and Cocoa, and when I used a lot of objects ranging from text field, text view, radio buttons, to check box, etc... and ran the simulator, it looks like working successfully. However, there are two warnings which are tagged with yellow triangles that read Misplaced view - Frame for "clip view" will be different at runtime in MainMenu.xib file.
What does the error mean? And how can I resolve the warnings? And finally, should I bother to work a bit harder to try to remove those warnings when I get to sell the app? (or does Apple still allow developers to sell an app even when it has some warnings but nonetheless sounds working?)
For your information, I didn't write any code in any of my files yet - just dragged objects out to Interface Builder, and edited and aligned those objects a bit and just ran it, which this book does (but this book assumes to use Xcode 4).
Thanks.
Xcode5 defaults to using Auto-Layout. The warnings mean that some of your UI elements do not have enough constraints set, so when you manipulate the UI (for example resize the window) things may look different than you intended.
When you open MainMenu.xib in Interface Builder, a yellow arrow should appear in the component section. Click that arrow and a view appears that explains the offending elements. Each has another yellow element that brings up a context menu with suggested fixes.
Optionally you can disable "Use Autolayout" of the nib.

Warnings: Misplaced View

I recently updated Xcode and I got the following warnings:
I tried Editor -> Resolve Auto-Layout Issues -> Clear all constraints in view controller but it did not work... I am using Xcode 5. How do I remove the warnings?
In Xcode 5 the position of views on the canvas does not update when constraints are applied. Thus, it is possible to have constraints that specify a different position for the view than you see it in Interface Builder. You can correct this by pressing Command + Option + = or selecting "Update Frames" in the |-•-| menu (I think it looks like a tie fighter).
Update for Xcode 8:
The "Update Frames" command now has its own button. It's located just to the left of the Stack View / Alignment / Constraints buttons and looks like a reload arrow surrounded by corner brackets:
Select this view in Storyboard, then 'Editor -> Resolve Auto-Layout Issues -> Update All Constraints in View'
It works for me.
Xcode 8: I got this warning with 1 UICollectionView in the Storyboard and no constraints at all. Switching the "View as"-Device at the bottom to any other device and back removes the warning.
In XCode 6 the Warning is now accompanied with dimensions indicating where the view will be placed given the current constraints. If your constraints are correct (or you believe them to be) and the view (eg. a label) is not at that location, try changing the view's dimensions to the expected dimensions in the warning. If the view ends up in the right place and the warning goes away, it confirms that your constraints are working as expected.
Simply removing the constraints may remove the warning but won't necessarily give you the Auto Layout behavior you are hoping for.
In Xcode 8.1 there is now a refresh button to the far left, click your views and click that to be the equivalent of the old update frames.
To be more specific, Select your view, Go to Editor Menu -> from Resolve Auto Layout Issues select 'Clear Constraints'. This should clear your constraints and no longer give you warning when you move your components.

Is there a tutorial somewhere about designing a really large view and put it in scrollView using storyboard

The question may be similar with
Designing inside a scrollview in xcode 4.2 with storyboards
but none of the answer there makes sense at all.
Okay I created a new controller and I added a scrollView.
The very first thing I noticed is there is NOWHERE to specify the content size of the scrollView.
Not in attributes inspector, not in size inspector.
Then what?
I am expecting some larger than normal box where I can draw all the view I want to put in. There is no such thing either.
I am very frustated.
All the "tutorial" out there tell about how to fill scrollView using code.
Another thing I tried is to select controller go to size inspector and then choose FREEFORM.
Great. I still can't make that template big.
Should I do this in XIB instead? At least on that one I can have one huge UIView. Or what is the official way industry standard way of doing this? Is there a WWDC for this one?
Say I want to draw something like these:
I don't think you can get a tutorial on this as it is simply impossible in IB. As most people already commented out what you want to do here need to be done programmatically.
If you are using XIB you can set up all your content there. Under the size tab (in the inspector) you will need to change the height to fill all your content but you still need to set up your contentSize programmatically.
For storyboard I don't think it is possible to change the size of your scrollview in IB.

(Mac) Panel Re-size issue

I've created an application for Mac that uses a horizontal resize view (technically a BWToolkit resize view) that is linked to a toggleCollapse button. After collapsing and expanding the panel a few times, this happens (see image) right table-view should be flush with panel divider. Any one have any info on why this is happening. I've carefully adjusted my alignment and anchors to be correct but it seems like this is a weird issue that bugs out the view?
EDIT: Is anyone NOT having this issue? Any input would be helpful! Maybe I just need to start fresh?
This is a known bug in BWSplitView itself, and is related to how view animation and timers interact in that view. The details are covered here:
http://bwalkin.lighthouseapp.com/projects/36323/tickets/34-split-view-doesnt-resize-subview-properly-during-a-toggle-uncollapse-after-manual-collapse
Basically, before the view is animated, autoresizesSubviews is unset, so that the view can be collapsed/expanded without affecting the contents; a timer is then scheduled to restore the autoresizesSubviews property for when the animation has completed. But (of course) the animation may sometimes finish ever so slightly earlier, or later, than the scheduled timer fires; so autoresizing is switched on before the animation has completed, resulting in a few pixels resize. As you've probably seen, the subviews tend to move around a bit as the view is collapsed and uncollapsed.
The "full" fix for this would be to restore autoresizing when the CAAnimation has completed using a callback, but this hasn't been implemented yet. However, in that thread "Robert Payne" has posted a version of BWSplitView.m which uses a slightly different approach - the view sizes are recorded before collapsing, and restored after expanding. I applied this patch myself (I think it won't compile at first - but it's a simple matter of an undeclared variable?) and can confirm it does fix the problem.
Let me know if you'd like a BWSplitView.m which compiles successfully, or a copy of the compiled framework.