Cannot Properly Resize MKMapView in Interface Builder - xcode

I try to insert and resize a MKMapView via interface builder (xcode 4.5).
However, the simulator shows different size/position compare to what we see in IB.
Any hint where could go wrong ?
Thanks.
http://i463.photobucket.com/albums/qq355/popov_kai/Untitled3.png

I'd say your textfield is pushed down by the navigation bar but the map is not. So in Interface Builder find the setting to simulate a navigation bar in your UI and then position your map according to that.

Related

Does Interface Builder's new IBDesignable attribute work with NSButton and other controls in Cocoa?

I have managed to get the IBDesignable/IBInspectable attributes working with direct subclasses of NSView but not with a direct subclass of NSButton. This is causing me to question if in fact the Cocoa implementation is somehow limited to NSView only.
Almost every example on the web (and Apple WWDC 2014 Xcode video) use NSView and then drag a custom view component from the library onto the canvas (and then change its class).
Is it possible to use IBDesignable with subclasses of NSControl and NSButton etc...? I have seen many examples on the web using UIButton.
If it is possible, then what are you supposed to drag from the library onto the canvas? It doesn't make sense for it to be a "custom view". On the other hand, there is no "custom control" available.
To be clear, I can get the IBInspectable attribute to show up at design time; but any changes don't seem to live render at design time.
The workaround is to wrap any custom NSButton I want to create within an NSView (via composition) but this seems like a bit of a hack...
I started playing around with a custom NSButton and NSButtonCell.
Dragging a button from the library onto the canvas and changing its class and the cell class doesn't live render. I think this is because Interface Builder still does a lot of custom things to setup NSButtonCell.
What works fine for me is dragging a custom view from the library onto the canvas and set its class. For this to work you need to setup the cell inside NSButtons -initWithCoder:.
Also I found a sample from Apple with a layer-backed custom Checkbox.
You need to drag an NSButton onto the view, then set the Custom Class to your specific NSButton descendant. Not sure why it doesn't work when you start with an NSView.
What can give you a hint is that the NSButton specific attributes aren't in the "Attributes Inspector". Hence there must be some setup at the time you drag the control onto the view.

Changing NSCollectionView dragging image while moving mouse around

I use a NSCollectionView as a toolbox (like in Xcode's Interface Builder). When dragging a tool out of the collection view I would like to change the "dragging image" under the mouse cursor into the real tool image. It should behave similar to Interface Builder when dragging a UI item into the users canvas. Es expected, it should change back to the previous image when I move the mouse back into the collection view.
I tried several delegate methods, but I can't see a way to change the cursor image during mouse movement.
Any suggestions?
Thanks to all! :-)
Regards,
Ulf
make a subclass of nscollectionview
override
func beginDraggingSession(with items: [NSDraggingItem], event: NSEvent, source: NSDraggingSource) -> NSDraggingSession
use setDraggingFrame(_:contents:)
you can get the mouse point from event.locatoinInWindow (dont forget converting to your collectionview cordinate)

Accessibility in Interface Builder in Xcode 4.3

I was wondering if anyone knows where the accessibility view in Xcode 4.3 is?
This is what I see in my IB; no tab for accessibility.
EDIT:
UITableView doesn't have an accessibility drop down because the items inside it (the cell, or actually the label and the buttons and whatever else you put into a custom table view cell) will be the accessibility items the user is looking for.
Original answer:
The accessibility label is available on many various UIView subclassed objects (such as controls like buttons).
If you're looking at the detail for any object in XCode 4's XIB / Interface Builder editor, you'll see a drop down field that looks like the below:

Interface Builder to follow full-screen and orientation rules?

I have an app that uses the "Status bar is initially hidden" property in the plist file to create a full-screen presentation. Works fine.
In the viewController, the shouldAutorotateToInterfaceOrientation method returns YES if interfaceOrientation != portrait or portraitUpsideDown, thus, my app works in landscapeLeft and landscapeRight. And it does so fine.
But, when I enter into Xcode 4's interface builder, my viewController and custom views all show the status bar, and are always in Portrait mode.
This makes it difficult to work with custom views that are 1024x768 fullscreen. I can never entirely tell easily if what I am seeing is in fact the full view PLUS the status bar, or if my custom view is showing behind the status bar, etc. And, particularly strange, my custom view retains an x,y coordinate system in Portrait mode, even when my app is in landscape. Usually, x and y switch places when I rotate a view controller, but this doesn't seem to work on a custom view.
So in short, how can I get my views and controller and interface builder to all be landscape-friendly, with no status bar?
In the IB, click on your main view and open the Attributes window (command-1). Under "Simulated User Interface Elements", change "Orientation" to "Landscape" and "Status Bar" to "Unspecified".
Remember, the IB doesn't read all of your code, so it doesn't know what you've done programmatically.

How do I rotate a view in Interface Builder?

I realize this is a painfully noob question but I just don't know what to do.
I'm trying to rotate my view in Interface Builder, and everyone refers to the rotate icon in the top right of the view.
My Interface Builder doesn't have this icon. See screenshot:
What am I doing wrong? Do I have to enable this in preferences or something? I'm using Interface Builder 3.2.2
Just alter the dimensions of the view. You will have to create a new one and connect it as an IBOutlet of the correct objects, but make it's dimensions 480x320 instead of 320x480.

Resources