interface-builder

Crash when using gesture recognizers in StoryBoard

雨燕双飞 提交于 2019-12-17 16:28:18
问题 UPDATE This is an old question for an old version of Xcode. It turned out that the issue was a bug in Xcode which has been fixed. Original I have a storyboard generated from making a new tab iphone application (with ARC) In one of my tabs, if I drag a gesture recognizer (any, but let's say Pan) onto a control, and then set the selector to an action, it just crashes as soon as I go to the tab. There is nothing in the Console -- it appears to be happening while the storyboard is being loaded

Fonts not displaying in Interface Builder

痞子三分冷 提交于 2019-12-17 16:11:34
问题 For some reason many of the fonts will not display in Interface Builder when I am designing my iPad app. Unfortunately my iPad is yet to be delivered so I cannot tell if this is going to be a problem in the long run, but it certainly maintains through to the simulator. The fonts in question are listed on various websites as being compatible with the iPad but SDK 4.0.1 still seems to be confused. For example Hoefler Text font assigned to a label drawn directly on fresh iPad view displays using

How do you display custom UIViews in InterfaceBuilder?

不打扰是莪最后的温柔 提交于 2019-12-17 15:39:57
问题 I seem to enjoy designing new UIViews and UIControls that implement their own -drawRect: method. This work well for me, especially when composed using UIViews in Interface Builder . But composing them in Interface Builder is annoying because they just show up as boring plain rectangles. It would be great if the views would actually render themselves as the built-in controls do. Is there any way I can structure my project so that Interface Builder will render my custom views? 回答1: In order to

Can't connect IBOutlet in Interface Builder

℡╲_俬逩灬. 提交于 2019-12-17 15:31:31
问题 I'm having a weird experience. I create any type of iPhone application, add a UIViewController with Xib file. I can edit the xib file with controls and see them rendered if I run. Now i'm trying to add a few IBOutlets to the controller, so I add them to the .h file, synthesize on the .m file. Then i head over to Interface Builder to connect the outlets. I drag the UILabel to the UIView, and then i try to connect the File Owner (which my custom UIViewController), but all that i can select when

How do I create a 1px line in Interface Builder?

可紊 提交于 2019-12-17 15:22:47
问题 Note, I'm looking to make a 1px line, not a 1pt line. Meaning it should be 1px regardless of screen scale (so 0.5pt on Retina devices). I can do this programmatically, but can I do it in the Interface Builder? For example I cannot set a UIView to have a height of less than 1. If I can do it in IB then I don't have to declare an outlet and manually set the frame in awakeFromNib . 回答1: Xcode 7.3 right down corner: add Height constraint in Pin. 回答2: Just in case someone else comes here wanting

Xcode - Is there a way to drag a component from one view to another without losing its frame?

≡放荡痞女 提交于 2019-12-17 15:18:35
问题 What I'd like to do is drag a component/view from one superview to another in Xcode's interface-builder without having its frame/position be reset. Xcode's default behavior when doing this appears to be to center the view being moved vertically and horizontally in its new superview, while preserving its dimensions. This is extremely frustrating, as it means that the view needs to be manually repositioned in its new superview. But I had it positioned correctly before I moved it, so I'd like

Programmatically send to front/back elements created from interface builder

亡梦爱人 提交于 2019-12-17 10:12:28
问题 In interface builder, there are layout options to send to back or send to front any elements such as UIButton , UIImage , UILabel etc... Now, I would like to do the same at runtime, programmatically. Is there an easy way to do that? I do not want to create different views, just update the z-axis. 回答1: There are a number of methods of UIView that allow you to modify the view hierarchy. bringSubviewToFront: sendSubviewToBack: insertSubview:atIndex: insertSubview:aboveSubview: insertSubview

Why won't my awakeFromNib fire?

蹲街弑〆低调 提交于 2019-12-17 09:49:48
问题 I am starting to move more of my view hierarchy construction to IB. I have a nib file called "AlignmentViewController.xib" in which I set up my view hierarchy with AlignmentViewController as the files owner. This works fine. One of the methods I remain fuzzy on is awakeFromNib. In the follow code snippet of AlignmentViewController I add the single additional method awakeFromNib. However, it does NOT get called: - (void)awakeFromNib { NSLog(@"AlignmentViewController - awakeFromNib"); [super

What are File Owner and First Responder in iOS - Xcode?

牧云@^-^@ 提交于 2019-12-17 07:01:16
问题 What are File Owner and First Responder in iOS - Xcode? 回答1: The File Owner is an instantiated, runtime object that owns the contents of your nib and its outlets/actions when the nib is loaded. It can be an instance of any class you like - take a look at the identity tab of the tool palette. File Owner is the main link between your application code and the contents of the nib file. For example, consider you have a UIViewController subclass with an IBOutlet for a UILabel. In interface builder

Reuse a uiview xib in storyboard

孤街浪徒 提交于 2019-12-17 06:22:39
问题 I typically like to create and design my uiviews in interface builder. Sometimes I need to create a single view in a xib that can be reused in multiple view controllers in a storyboard. 回答1: Reuse and render a xib in a storyboard. Tested with Swift 2.2 & Xcode 7.3.1 1 ---- Create a new UIView named 'DesignableXibView' File > New > File > Source > Cocoa Touch Class > UIView 2 ---- Create a matching xib file named 'DesignableXibView' File > New > File > User Interface > View 3 ---- Set the file