How do I anchor controls to one side in Xcode? - xcode

Ok, so I come from programming in Visual Basic on PCs, and now I'm trying to remake my programs on OS X with Xcode, and so far I have been successful. One thing I have noticed, however, is that when I try to resize the window, controls either stay in the same place or stick to one side. In Visual Basic, I used the "anchor" or "dock" properties to decide whether controls would stretch as the window resized or if the stayed to one side. I was just wondering if there is an easy way to do this in Interface Builder. I am using Xcode 4.5.1 and any help I could get would be great.
Thanks in advance!

In IB, click on the file inspector (The first icon), then make sure auto layout is not checked. Then go to the size inspector (The 5th icon) and make your changes.
(source: fredandrandall.com)

Related

How can you modify the styling of a compiled macOS app without the Xcode project and without additional apps?

Does anybody know, how to change the appearance of the title bar and/or toolbar of a simple & small one-window cocoa macOS application without accessing the Xcode or installing third party applications? It's for a screen recording video project, I want to do.
I know, that there are possibilities within the applications info.plist (for example changing the app title inside the top macOS Menu Bar) but I would like to be able to change the apps window title itself and/or colors and/or fonts inside the window title bar or toolbar if possible.
Opening the app in another container window or via terminal or Applescript and adding custom parameters or even an overlay in the right position to change the styling would be okay if this is possible?
Can somebody point me in the right direction?
Thank you very much!
in short: Nibs
Nib File Viewer works until Xcode 10
saving, recompiling if possible
good luck

"Auto Layout before OS X 10.7"

I have an app in the app store, FractalWorks, which is based on a very old code-base. It's a big app, with quite a few screens. It was created in Objective-C before auto-synthesized properties were a thing, to give you an idea of how long ago it was created.
I wrote the app when I had a full-time gig as an independent software developer. I've since taken a day job, and support my apps in my spare time.
It still sells fairly well, and I recently used to add a section to the Wikipedia article on the Mandelbrot set on 3D images: https://en.wikipedia.org/wiki/Mandelbrot_set#3D_images_of_Mandelbrot_and_Julia_sets
I'm fluent in Auto-Layout now, but haven't taken the time to update the app's XIB files from "struts and springs" style to Auto-Layout - nor do I want to invest the time to do so if I can possibly help it.
I want to add a minor enhancement to the app that involves adding some UI elements and making one of the windows slightly taller. The minute I try to use Interface Builder to edit my XIB, it apparently silently changes it to Auto-Layout, and then complains about "Auto Layout before OS X 10.7". (It was released to the app store for OS X version 10.4, if memory serves, and I've moved the OS version up to the lowest version I could get away with in order to support legacy customers. It currently supports ≥10.6. The original, pre app-store version used even older OS versions.)
Googling this error suggests I use the file inspector on my XIB file to un-check a "Use AutoLayout" checkbox, but I don't see any such checkbox.
What am I missing?
If I use Xcode's code review button to compare the XIB file before and after editing it, various "tool version" values are changed, as well as it gaining a setting useAutolayout="YES". Editing that to read useAutolayout="NO" does not solve the problem.
All the credit goes to matt and his comment.
1. In the Navigator (left panel) go to issue navigator and click on the error.
2. In the Inspectors panel (right panel) the Size inspector will be automatically selected. Switch Layout from Automatic to Translates Mask Into Constraints.
Update: It's called Autoresizing Mask now.
3. Repeat for every occurrence of this error.
You may end up with an error not in the Illegal Configuration group like the following which opens the All Messages view in the middle and doesn't open the Size inspector.
This is a compile time error, just build/run your app again.
And also from the previously mentioned comment:
Be careful not to make any constraints, as that will cause an incoherent situation.
If you have multiple auto layout errors, which in all likelihood you will have, select all the controls in a window and perform the operation once rather than for each individual control. Repeat for each window.

missing alignment guides in xcode interface builder

I am new to programming on the Apple Mac. I have followed a programming guide supplied in the Mac Developer Library to program a basic GUI program called TrackMix. In this program you place a textbox, a vertical slider and a button control on the view window. Initially, on dragging the specific object, say the textbox, to the window, a set of alignment guides (dotted blue lines) would automatically appear on the canvas when the object is dragged over it. I dont know what has happened, but now those guides have disappeared when I execute the same action of dragging objects to the window. When the object being dragged is over the window a small green dot, with a plus sign in it, appears on the bottom of the object. I have carefully retraced my steps to be exactly the same as stated in the Developer Library, but still the problem persist. Have I, perhaps, involuntarily changed some Xcode settings or what? I am at the end of my wits! PS: I am using Xcode 7.
You have to toggle the menu item "Editor > Canvas > Snap To Guides" in Storyboard. I hope that helps
I am not sure whether this will be helpful, but I just had the same problem and the only thing which worked was re-installing Xcode (7.3) and trashing all of the Xcode preferences.
Good luck.

I see absolutely nothing under Size Inspector in Interface Builder. I want to be able to set the Auto

I see no settings at all under Size Inspector in Interface Builder, it is completely blank for my View, all labels and all buttons. I am using xcode 4.6 and have 'Use Autolayout' unchecked and the metrics (Size, Status Bar, Top Bar, Bottom Bar) are all 'None'. I need to be able to control the autoresizingmask, but why can't I see any size properties?
Once you switch to Size Inspector tab, directly under the icon there is a little header that says "View." If you hover over that some text appears that says "Show," because apparently that section can collapse down. Clicking the header should cause the options you expect to appear.
I wish they would make this more clear, because I completely missed it as well, and restarted Xcode several times.
I ran into this problem using Xcode 5.0 but upon further investigation, discovered the dysfunction ran to a higher degree - all Inspector views in Xcode were blank for every control, and the Navigator buttons didn't work either.
The culprit seems to have been a conflict in versioning. When I re-checked out trunk, Xcode returned to expected behavior.
Resizing the Xcode window made things right again for me - go figure.
This worked for me......
Clear Menu -> Recent Files
i cleared last open storyboard from Recent files
Restart Xcode

Moving graphical components with the mouse in Visual Studio

I have just installed Visual Studio.NET. In the Design area I have added some graphical components (button, textbox) but I can't move these within the specified area, as their position remains unchanged. I would like to move these graphical components with the mouse cursor, I know it's possible, does anyone know how?
It sounds like you have created a WPF project. WPF works a lot differently than WinForms which you are probably used to. So try creating a WinForms project, or get yourself acquainted with WPF.
I came here looking for the answer to the same question. OP is probably no longer interested and it was quite easy to Google it up, but in case somebody comes here as I did, here is the solution:
In WPF, place a Grid component on your form (or in your container, like Tab), and reset it (set both Height and Width to auto). Then you can place other controls and position them with your mouse normally.

Resources