iboutlet

How to loop through Outlets of a UIViewController with Swift

时间秒杀一切 提交于 2019-12-28 04:21:11
问题 I'm wondering, if it's possible to loop through all outlets of a UIViewController with swift. Specificly, I want to check if every textfield is filled by the user. 回答1: This is what Outlet Collections are for. Drag all your textfields in the same Outlet Collection in InterfaceBuilder and create an @IBOutlet to that collection in your class file: To create the outlet collection in InterfaceBuilder, ctrl-drag from the first UITextField to your class file in the assistant editor. Then choose

IBOutlet is nil, but it is connected in storyboard, Swift

和自甴很熟 提交于 2019-12-27 11:04:31
问题 Using Swift 1.1 and Xcode 6.2. I have a UIStoryboard containing a singular, custom UIViewController subclass. On it, I have an @IBOutlet connection of type UIView from that controller to a UIView subclass on the storyboard. I also have similar outlets for subviews of that view. See figure A. But at run time, these properties are nil (Figure B). Even though I have assured I've connected the outlets in Interface Builder. Thoughts : Is it possible that because I am using a subclass of a subclass

IBOutlet is nil, but it is connected in storyboard, Swift

荒凉一梦 提交于 2019-12-27 11:04:06
问题 Using Swift 1.1 and Xcode 6.2. I have a UIStoryboard containing a singular, custom UIViewController subclass. On it, I have an @IBOutlet connection of type UIView from that controller to a UIView subclass on the storyboard. I also have similar outlets for subviews of that view. See figure A. But at run time, these properties are nil (Figure B). Even though I have assured I've connected the outlets in Interface Builder. Thoughts : Is it possible that because I am using a subclass of a subclass

Xcode 8.3.3 - Not allowing to connect IBOutlet to the storyboard

早过忘川 提交于 2019-12-25 18:11:51
问题 I realised that my maps app was not connected to the new storyboard. I have tried everything (to my knowledge) and have just about run out of ideas. And yes I have changed the class in the storyboard to the map controller that I am trying to connect it to. 回答1: To connect objects to already existing outlets you need to mouseover the variable name instead of the gutter. Like so: 回答2: please check your class name in "show the identity inspector" panel as in following image. 来源: https:/

IBOutlet nil after instantiateViewControllerWithIdentifier

旧时模样 提交于 2019-12-25 05:31:39
问题 Not sure exactly what I'm doing wrong here. I've listed out what my problem is and my code. Would love to get some help. Thanks! Problem: VC1 presents VC2. IBOutlets from VC1 are now nil. VC2 dismisses back into VC1. IBOutlets in VC1 are still nil. VC1 loads a grid of pictures from flickR. VC2 has a searchBar controller, when VC2 is dismissed it does runs flickR query. Right before my self.collectionView.reload() fails because self.collectionView is nil :( VC1 import UIKit class

Chromium Tabs in Cocoa (Outlets turning up NULL from 'TabContents.xib')

别说谁变了你拦得住时间么 提交于 2019-12-24 19:20:07
问题 I'm struggling to use Chromium Tabs in Cocoa and I really seem to be missing something. I've subclassed CTBrowserWindowController ( ppEditor ), CTBrowser ( ppDocumentBrowser ), CTTabContents ( ppDocument ) and CTTabContentsController ( ppDocumentController ) Editor creates new Documents by : [self addTabContents:(ppDocument*)doc]; (and I've also tried first adding a Document Controller for the specific document first, but this doesn't work either) I'm connecting my outlets from TabContents

Can't create IBOutlet for UIBarButtonItem in a UIViewController

↘锁芯ラ 提交于 2019-12-24 08:39:43
问题 I'm trying to create an IBoutlet from a UIBarButtonItem to a UIViewController, but when ctrl+clicking and dragging to the controller, I see no indicator whatsoever, and thus it's impossible to create it. Not sure what I'm doing wrong. Here's the screenshot, in case it could clear something up: Thanks a lot in advance! EDIT: I also tried to create the IBOutlet manually with @property (weak,nonatomic) IBOutlet UIBarButtonItem *barButtonItem; and then ctrl+clicking and dragging, but same result.

Objective-C iOS Development Using viewDidLoad or initWithCoder when setting Variables and Why?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 20:35:17
问题 So it seems like I should be setting my member variables in viewDidLoad - but I am confused as to why setting these variables in initWithCoder fails, since both are called at the start of the program. In particular I have a line of code: [worldView setMapType:MKMapTypeSatellite]; In which worldView is a IBOutlet MKMapView object. It works under viewDidLoad , but not initWithCoder . 回答1: The objects do not yet exist when initWithCoder is called, and they do when viewDidLoad is called. Check

Can't link to outlet collection in XCode9

守給你的承諾、 提交于 2019-12-23 12:17:21
问题 I have some constraints that a shuffle around during an animation. After upgrading to XCode9 I tried to make some tweaks, and the editor seems to no longer allow me to add constraints to an constraint collection IBOutlet. I even created a new project and tried to make a simple outlet collection and ran into the same issue. Here's a short video of what I'm talking about: I've tried the usual things of deleting derived data, restarting xcode, creating new xibs, praying to the xcode gods...etc.

Accessing IBOutlet from another class

本小妞迷上赌 提交于 2019-12-22 06:57:18
问题 I am calling a class function from my ViewController class like this: Buttons.set_cornerRadius(10) I have another .swift file where I have the function declared: class Buttons { class func set_cornerRadius(radius: CGFloat) { ViewController().someButton.layer.cornerRadius = radius } } When I'm trying to run this it throws the error: "Unexpectedly found nil while unwrapping an optional Value" . I checked the Storyboard-IBOutlet connections already. Everything is connected right. If I call the