开发者

How can I display a hidden view in Interface Builder which is on a unattached monitor?

开发者 https://www.devze.com 2022-12-29 17:05 出处:网络
I am using Interface Builder to work on NIBs and one of the NIBs must have a view on my external monitor which is not attached because I cannot see it on my MacBook. I have had this problem with editi

I am using Interface Builder to work on NIBs and one of the NIBs must have a view on my external monitor which is not attached because I cannot see it on my MacBook. I have had this problem with editing iPad NIBs which I work on with my larger external monitor.

For some reason Interface Builder is not detecting that there is now just one screen and not pulling this view onto this monitor. There has to be a way to get this back into the visible space so that I can work on i开发者_如何学Pythont. I have tried double clicking on the view icon in the organizer which normally brings the view forward but it is not coming into view.

What can I do? Is this really a bug that has been around this whole time?


I was seeing this problem as well -- the easiest way to fix it is:

  1. In Interface Builder, double-click on the view object. This would ordinarily bring up the window and give it focus, but in this case it's invisible.
  2. Hit Cmd-W to "close" the invisible window
  3. Double-click the view object again; the window should now re-open onscreen.


Yes - it messes up this way when a XIB is created on a computer with multiple monitors but then later edited on different computer with just one.

To my knowledge the only way to fix is to to open the XIB with a text, or ideally XML, editor and search for negative values in various positioning strings. I've searched for {{-and then changed any negative values found to 0. For example, you'll run across {{-237,172}} When you find the open brace, open brace, minus sign pattern then change the negative value to a zero. i.e. {{-237,172}} becomes {{0,172}}.

When you re-open the XIB in IB you'll then be able to see your views.

To be safe make a copy of the XIB before hand editing.


Try using Exposé to see if the window shows up there. Ordinarily you can use Window > Arrange in Front to rearrange your windows, but it seems the non-document windows in IB don't obey ordinary Cocoa window handling so this command has no effect on them.

I wasn't able to reproduce it myself (when I disconnected my 2nd monitor, the window on it moved to my main monitor), but it may have something to do with the arrangement of your screens. If this turns out to be an IB bug you can reproduce, please file it (bugreport.apple.com).


Not sure if this will work, but open the window from your xib (double-click it) in Interface builder, then go to the "Window Size" section of the inspector. 2 Places might help in there, first the "Initial Position" shows a representation of the window and you might be able to just drag it back to the proper place. Second is "Content Frame". There are "X and Y" settings so try changing them to 0 and see if that does it.


<object class="NSMutableArray" key="dict.values">
                <bool key="EncodedWithXMLCoder">YES</bool>
                <string>WhatEverYouNamedIT</string>
                <string>UIResponder</string>
                <string>{{237, 644}, {320, 480}}</string>
                <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
            </object

I opened the .xib file with Dashcode and changed the {{237, 644} to {{0, 172} saved and opened with IB and the view "canvas" windows was back on my laptop screen everything else opened up on my external monitor.

THANKS!!!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号