interface-builder

Reuse a uiview xib in storyboard

依然范特西╮ 提交于 2019-12-17 06:21:38
问题 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

Is there a way to change the height of a UIToolbar?

给你一囗甜甜゛ 提交于 2019-12-17 04:45:17
问题 I've got an UIToolbar in Interface Builder and I've noticed that it's locked to being 44px tall. Of course I'd like to make this larger. Does Apple allow resizing of this control? If so, how do I go about it? 回答1: Sure, just set its frame differently: [myToolbar setFrame:CGRectMake(0, 50, 320, 35)]; This will make your toolbar 35 pixels tall. Of course this requires an IBOutlet or creating the UIToolbar programmatically, but that's very easy to do. 回答2: If that does not work in SDK 6, it is

Is it possible to set UIView border properties from interface builder?

扶醉桌前 提交于 2019-12-17 02:33:19
问题 Is it possible to control UIView border properties (color, thickness, etc...) directly from interface builder or I can only do it programmatically? 回答1: Actually you can set some properties of a view's layer through interface builder. I know that I can set a layer's borderWidth and cornerRadius through xcode. borderColor doesn't work, probably because the layer wants a CGColor instead of a UIColor. You might have to use Strings instead of numbers, but it works! layer.cornerRadius layer

How to use auto-layout to move other views when a view is hidden?

徘徊边缘 提交于 2019-12-17 02:25:53
问题 I have designed my custom Cell in IB, subclassed it and connected my outlets to my custom class. I have three subviews in cell content which are: UIView (cdView) and two labels (titleLabel and emailLabel). Depending on data available for each row, sometimes I want to have UIView and two labels displayed in my cell and sometimes only two labels. What I am trying to do is to set constraints that way if I set UIView property to hidden or I will remove it from superview the two labels will move

How to load a UIView using a nib file created with Interface Builder

我的未来我决定 提交于 2019-12-16 22:06:21
问题 I'm trying to do something a bit elaborate, but something that should be possible. So here is a challenge for all you experts out there (this forum is a pack of a lot of you guys :) ). I'm creating a Questionnaire "component", which I want to load on a NavigationContoller (my QuestionManagerViewController ). The "component" is an "empty" UIViewController , which can load different views depending on the question that needs to be answered. The way I'm doing it is: Create Question1View object

Error on Dead Outlets / Actions in Interface Builder

微笑、不失礼 提交于 2019-12-14 04:21:10
问题 Is there a way to have Xcode refuse to build an app due to there being a dead outlet or action in my Xib, Nib or Storyboards ? I quite often build an app only to find it crashes due to a interface builder file is pointing to a key on my class which no longer exists. I am slowly coming to the conclusion it is better to construct these pieces of UI programatically but I was wondering if there is a way at least for my older projects of Xcode warning me against these things ? 回答1: Well, it can't.

UITableView with large static cells doesn't scroll to where it should

China☆狼群 提交于 2019-12-14 03:58:34
问题 So I have a unique iOS project (read as clients accepted a design before I started working here and the design contains checkboxes, dropdowns, tabular data (rows+columns,etc.) which requires a long tableview which contains 3 sections, the sections themselves vary from 50-700pt. It appears this wasn't something Apple took into account as the table view does not scroll properly to all cells, specifically, when the keyboard is not yet open and I click on a textfield at the bottom of a long

How to instantiate an NSObject in the Interface builder .xib file

不羁的心 提交于 2019-12-14 03:58:10
问题 Greetings, I have a view based application project where I have created an NSObject class called "SquareClass". Now, from the Xcode's interface builder, I want to be able to instantiate that "SquareClass" into a square object with global scope, in such a way that, when I create actions from any UI controls(i.e textboxes, buttons etc...), I want to be able to call methods of that object within those actions. example: (void)MyAction1:(id)color { [square setColor:color]; } (void)MyAction2:(id

Interface Builder's “Simulate Interface” is gone in xcode 4.6?

不想你离开。 提交于 2019-12-14 03:54:48
问题 Is it possible to 'simulate interface' in xcode 4.6? The command seems to be missing :-( 回答1: I am using Xcode 5 and you can find this feature under Editor-> Simulate Document (not the Edit menu) as others have pointed out. However, this feature is only available for Mac xibs and is not available for iOS xibs. I am guessing this was probably the same situation in Xcode 4.6 back when the question was originally asked, hence the confusion in the other questions and comments. 回答2: Is it possible

Rotating Labels

你说的曾经没有我的故事 提交于 2019-12-14 03:12:26
问题 I have a need to rotate editable labels in IB - I'm aware that you cannot rotate in Interface Builder itself. However, does anyone have any info on how to do this via xcode? Hopefully it's not too daunting as I'm new to cocoa : / Any help would be appreciated! Zach 回答1: See NSView 's - setBoundsRotation method. 来源: https://stackoverflow.com/questions/4998229/rotating-labels