interface-builder

IPhone: How to Switch Between Subviews That Were Created in Interface Builder

早过忘川 提交于 2019-12-21 06:58:32
问题 So I basically have two subviews within my main view. I created each subview by going to the library in IB and dragging a view onto my main nib file and then positioning controls on them. Now, I'd like to flip between these views via a "flip" button. What I don't understand is how I can programmatically do this. My question is: do I "Hide" one of the subviews and then unhide it someway programmatically when I do the flip? Do I give each a name via the Interface Builder and do it that way? I

Singleton in Interface Builder with ARC

三世轮回 提交于 2019-12-21 05:08:18
问题 My question is quite similar to this one: Use Singleton In Interface Builder? The only difference is that I use ARC. So, if simplified, my singleton looks like that: Manager.m @implementation Manager + (instancetype)sharedManager { __strong static id sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedInstance = [[self alloc] init]; }); return sharedInstance; } @end So the question is if it's possible to adopt it for Interface Builder still being with

User Interaction on a UIImageView

房东的猫 提交于 2019-12-21 05:00:29
问题 I have a number of UIImageView which have buttons on top of them. I would like to enable user interaction on the UIImageView behind these buttons. I see the option in IB, but would like to know how to trigger some code when the UIImageView is actually touched. How does one do this and how is it set to enabled and disabled in the code rather than IB? Thanks 回答1: how to trigger some code when the UIImageView is actually touched. You have two options: Create an instance of UITapGestureRecognizer

float:left in objective-c

谁说我不能喝 提交于 2019-12-21 04:05:00
问题 I'm trying to make a bunch of buttons behave somewhat like float:left in CSS. So whenever the view changes size, on orientation change for example, the buttons should adjust so they fit within their container view. In landscape mode, this UIScrollView should scroll horizontally, in portrait mode, it should scroll vertically. I'm trying to make an ScrollView similar to the "Featured" tab in the iPad YouTube app. Landscape has 4 columns, portrait: 3 columns, "Subscriptions" tab, portrait, the

How do you adjust text kerning using Interface Builder in Xcode 7?

点点圈 提交于 2019-12-21 04:04:51
问题 There are a myriad of settings for NSAttributedParagraphStyle that I can see in Interface Builder: But none of these are for text kerning. Is there a way to adjust the text kerning in Xcode 7's Interface Builder for attributed text? (Please don't answer with how to do this in code - I already know how to do that!) 回答1: You can actually do this without the use of a subclass through an extension. import UIKit @IBDesignable extension UILabel { @IBInspectable public var kerning:CGFloat { set{ if

Xcode 4, Interface Builder and the Awareness of Classes in a Static Library

大兔子大兔子 提交于 2019-12-21 03:52:31
问题 Although Xcode 4 is advertised being aware of cross-project classes of projects in a shared workspace, I didn't find this working and did some research about the problem. The common solution discussed in many threads around here is, to create a static library and link your projects against it. I therefore followed Jonah's guide (http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/) and created a static library to share frequently used subclasses of UIView with

Xcode 4.5 + UIScrollView: Cannot see struts and springs (OSX 10.8 Mountain Lion)

纵饮孤独 提交于 2019-12-21 03:32:13
问题 Disclaimer: Brand new to iOS dev. Go easy on me. Got a funny situation in Xcode 4.5. My Size Inspector looks like this: ...and I can't see the struts and springs area at all . The really strange part is that when I click away to something like the Connections inspector I do see the struts and springs area, but only for a split second, and it is gone when I come back. Is this normal? Is there an easy way to correct this behavior? 回答1: In Xcode 4.5, for iOS 6 and OSX 10.8 development,

UIButton, created by Interface Builder, is crashing

北城以北 提交于 2019-12-21 02:54:01
问题 I have narrowed down an ugly bug, but since it seems like something internal to the nib/Interface Builder, I'm at a loss of what to do next. I've got a UIView created in IB which functions as a custom dialog box. It shows a message and two buttons. (Proceed or Cancel.) Both buttons have a Background image set in Interface Builder. Something is wrong with the way the background image for the cancel button is being handled. With NSZombieEnabled, I've been running the program. Most often, the

How to create an UIViewController with UINavigationController with Interface Builder?

眉间皱痕 提交于 2019-12-21 02:48:09
问题 In my iOS application, I want to provide a settings-view. "presentModalViewController" works very well: ViewSettings *controller = [[ViewSettings alloc] initWithNibName:@"ViewSettings" bundle:nil]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller]; [self.navigationController presentModalViewController:navController animated:YES]; [controller release]; [navController release]; Unfortunately, I have to change my running code and

How to disable “Relative to margin” option for newly created constraint in Xcode6

China☆狼群 提交于 2019-12-20 16:21:08
问题 I want to disable automatic adding Relative to margin when creating constraints in IB of Xcode 6 . It's nice that they turn this option on by default, but I have to support iOS7 , so it turned out I have to manually disable this option every time after adding new constraint. I found this setting for disabling it beforehand, but it's always on by default. 回答1: This plugin will set a default value of Constrain to margins to disabled. https://github.com/mshibanami/DefaultMarginDisabler 回答2: The