editing views in IB that start off the screen - objective-c

I have some views that start off the screen and then slide in and out at various times. In IB, the x,y positions are off the screen, because that is where I want them to start.
Now, I could just put them anywhere in the x,y space in IB and have the viewController's viewDidLoad method move them off the screen initially.
My question is, since they are currently off the screen in IB, is there an easy way to access and edit them in IB without changing the x,y position of a view first so that it appears on the screen in IB? Because I am editing these views fairly often.
If there isn't, then I'll probably just position them anywhere in the visible space in IB and add some stuff to viewDidLoad to get them out of the way. Or any other suggestions I'd love to hear.

If it's a separate view, just drag it to where you want it, and double click it's name in the objects list as seen in edo42's answer. You could also figure out the final x/y coordinates and set those with your code, and just move the view wherever is convinient.

You click there
and then select your view here

Related

weird gap when using uiscrollview and uilabel

here is the problem i have a tow muti-line label with many content, so I use a scroll view to show them all
then I follow this to do the autolayout: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html#//apple_ref/doc/uid/TP40010853-CH5-SW2
basic idea is to make a container view outside the scroll view to make sure the labels can fill the scroll view no matter what direction it is.
here is the hierarchy and constraint:
and the portrait mode works well:
but when it change to landscape mode some wired gap pops up!
and the more text i put in the label the higher gap i got!
my question is what should i do to kill those gap?
please give me some explicit solution or just give me an example, thank you!
and i am using autolayout in ios7, so some solution without coding are preferred!

NSPopUpButton in NSToolbar such annoying

Problem solved!:
Just check the "Unified Title And Toolbar" option of the NSWindow and the 1pixel-down problem goes away!
To change the toolbar height just select the Toolbar Item - Custom View and change size in the Size inspector.
==============================
If you know Xcode 5s layout than you should recognise this:
I want to build it for my own. So I dragged a Toolbar in the Window and added a NSPopUpButton. Then I changed the PopUp Button Cell Style to Radio and turned off the Arrows. So far so good.
The first thing I noticed is that the Toolbars has different heights. Does anybody know how to change this behaviour (without subclassing NSToolbar)?
The second and more annoying thing I noticed is that if I choose an Item from the PopUp Button the Image for the NSMenuItem move 1 pixel down.
EDIT: Xcode NSMenuItems don't move 1pixel down
Any suggestions about that thing?
NSToolbar, sadly, can’t really be subclassed. It’s a poorly-written class that tries to be very “magic,” so it’s not even a subclass of NSView—you can’t control how it draws at all, it creates a private view.
You can set its “sizeMode” but I assume you’ve already done that and found that the number of pixels high isn’t what you want.
The easiest thing to do is just leave space for your widgets at the top of your window (above the document content) and have autolayout position your buttons for you. (I haven’t been able to use a real NSToolbar in years because of its limitations.)
As for the popUp menu being mis-aligned with the button: where the menu draws is basically hard-coded, so if you use a button style that NSPopUpButton doesn't expect then the menu will be offset some.
If you’ve already tried just unchecking the “draws border” flag on a default-style NSPopUpButton (one fresh off the palette), There are two solutions for to try: One is to keep trying different buttonStyles that look correct to your eye until you find one that’s not offset. Two is to leave the buttonStyle do the default for NSPopUpButtons but subclass the buttonCell and have it not draw the border (but still leave room for it).

Retain positions after pasting UIImageViews in new UIScrollView

I made a prototype for an app, just as a proof of concept to test whether the functionality is working properly or not. Now that I am satisfied with the working functionality, I want to paste the images I placed in a UIView into a UIScrollView, so that I can show data in different pages. But, as I select the elements and paste it in a scrollview, all the positions are lost, and I have to manually place the elements in the interface builder.
Check out this image, I have these many elements that I need to paste inside the UIScrollView.
Is there a better way of doing this? or do I have to manually place the elements in positions I want?
Thanks!
If you want to avoid the headache of repostioning of controls in IB, then try the following option
1) Take one more UIView.
2) Add the UIScrollView into the UIView.
3) Add your current UIView(view which you shown in question) into the UIScrollView.
Thanks.
Select all your children, then Menu/editor/embed in scroll view.
Et voilà !

Resizing an NSView smaller than its subviews?

Couldn't find anything on the net about this and wondered if anyone on SO has a solution.
I have an NSView with several subviews that are centered by removing the left and right anchor points. When I resize my view, programatically or with the mouse, to a smaller width than the subviews: it pushes them off center. Has anyone come across this before and do you have a solution?
EDIT: I want to be able to resize my view to a zero width. The reason being, the view is actually part of a split view and I have hooked up a button to 'collapse' it. When it collapses all of the subviews are pushed off-center and aren't re-centered when the view is resized, effectively un-collapsing it.
I have solved my problem now and thought I would share incase anyone comes across this issue in the future.
No amount of playing with autosizing options or view layouts in Interface Builder seemed to stop my subviews from getting moved off center. I did manage to find this link here and from this page, the advice:
Springs and struts, as currently
implemented, are really no good for
anything but keeping either one or
both sides of a view "stuck" to the
nearest edge. Any sort of centering
behavior, division of gained/lost area
between multiple views, etc. has to be
done by hand.
Based on this I overrode my view's setFrame: method and manually laid out my subviews using their setFrame: method. This works great and gives me the results I'm looking for.
There is the same issue using NSSplitView, resizing here one Subview to be smaller than the Subview Subviews makes sense,e.g. having small charts in the upper subview, and an rss reader in the lower subview.
If you want to show only the rss reader in the lower subview, you can "hide" the upper subview, but after resizing the upper subview the NSImageView are not layed out the same as in the beginning. Check this nib/xCode Project and the following screenshot to see this behaviour.
Only workaroung is to override the resize function to stop getting smaller.

How to organize XIB files with many overlapping elements?

I have some XIB files which are very difficult to edit because many of the subviews overlap each other completely. For example, if I position a popup volume slider where it will pop up, it covers some UILabels which become impossible to click. My only chance to be able to edit them is to double-click on them in the Document window tree, move them aside, edit, then move them back. Sometimes there are 3 or more widgets that occupy the same location in the XIB, even though only a few are visible at a time while the application is running.
How are conditionally-visible screen elements actually supposed to be organized?
I would like to be able to hide groups of views to reveal what's beneath them, but I don't see a way to do that in IB.
If I create UIViewControllers for every group, I can edit them in separate windows, but I can't see them in context, and I need a lot of view controllers...
Tip: Hold down shift while right clicking the location of the object you wish to select.
I don't think IB is able to hide groups of views during design-time, but there's no reason you couldn't add that behavior yourself using an IB plugin.