iboutlet

Can you hard code IBActions and IBOutlets, rather than drag them manually in Interface Builder?

一世执手 提交于 2019-11-26 20:43:42
问题 Is it possible to to hard code the IBAction s and IBOutlet s in code, instead of drag-connecting them in Interface Builder? 回答1: Yes it is poosible... sample code UIButton *btnDetail = [UIButton buttonWithType:UIButtonTypeRoundedRect] ; [btnDetail setFrame:CGRectMake(250.0f, 15.0f, 65.0f, 20.0f)] ; //btnDetail.backgroundColor = [UIColor grayColor]; [btnDetail setTitle:@"Detail" forState:UIControlStateNormal]; [btnDetail setTitleColor: [UIColor redColor] forState: UIControlStateNormal];

Swift put multiple IBOutlets in an Array

跟風遠走 提交于 2019-11-26 20:21:31
问题 I made these (marked with red border) IBOutlets using ctrl + drag But i don't like to have the exact same line 9 times (DRY) How do i put these IBOutlets in an Array? 回答1: you can define a generic outlet collection in Swift like this: @IBOutlet var collectionOfViews: Array<UIView>? // = [UIView]? or for e.g. UIButton objects: @IBOutlet var collectionOfButtons: Array<UIButton>? // = [UIButton]? you can find your collections under the Outlet Collections group as usually are in the File's Owner

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

谁说胖子不能爱 提交于 2019-11-26 20:10:34
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 something messes up with the initialization? I am not overriding any initializers awakeFromNib: is not

“Could not find any information for class named ViewController”

醉酒当歌 提交于 2019-11-26 18:55:08
问题 This bug has been driving me nuts since I started using Xcode (4.6.3). Whenever I try to link a Storyboard item to my code, I get the error: Could not find any information for class named ViewController. This happens with custom classes as well. I've tried methods such as: Deleting the delegate data. Removing and re-adding the classes. Restarting Xcode. Reinstalling Xcode. I can't ctrl-drag to create connections in any of my projects no matter what the class is. The same problem happens with

Connect outlet of a Cell Prototype in a storyboard

浪尽此生 提交于 2019-11-26 17:57:40
问题 I'm a newbie with the Storyboard and so I have some difficulties... I have created a TableViewController and I would like to customize the Cell Prototype. In the Cell Prototype I have added several Labels I would like to customize with my own class which inherits from UITableViewCell (AreaListCell). In the Storyboard, for the Cell Prototype I have configured the Custom Class with "AreaListCell" and its style is "Custom". In the storyboard, when I select the Cell Prototype and then the

Xcode Interface Builder - “correct” way to delete/rename miswired IBoutlets / IBactions

点点圈 提交于 2019-11-26 15:45:19
问题 I am new to Xcode, working through Swift, so I'm not sure if what I am decribing is actually a bug. When using interface builder and the assistant editor, I can create lables, buttons etc, and create Outlets and Action in the code with a control-drag. So long as I am perfect, no problem. But I seem to run into problems if, for example, I make a mispelling of the object name. Or, I choose outlet instead of action. I can't seem to find a way to make a correction that does't seem to totally

Could not insert new outlet connection: Could not find any information for the class named

你说的曾经没有我的故事 提交于 2019-11-26 14:59:38
问题 This post is a Community Wiki . Edit existing answers to improve this post. It is not currently accepting new answers. I got an error on Xcode saying that there was no information about the view controller. Could not insert new outlet connection: Could not find any information for the class named Why is this happening? 回答1: Here are some things that can fix this (in increasing order of difficulty): Clean the project ( Product > Clean ) Manually paste in @IBOutlet weak var viewName: UIView! //

IBOutletCollection set ordering in Interface Builder

蹲街弑〆低调 提交于 2019-11-26 12:00:22
问题 I am using IBOutletCollections to group several Instances of similar UI Elements. In particular I group a number of UIButtons (which are similar to buzzers in a quiz game) and a group of UILabels (which display the score). I want to make sure that the label directly over the button updates the score. I figured that it is easiest to access them by index. Unfortunately even if I add them in the same order, they do not always have the same indexes. Is there a way in Interface Builder to set the

Swift - IBOutletCollection equivalent

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 08:21:37
问题 I\'m trying to replicate the Stanford Matchismo game from \"Developing ios7 apps for iphone and ipad\" in iTunesU in Swift. On page 77 of the 3rd lecture slides, it shows using an IBOutletCollection which isn\'t an option on Swift. The Swift doc example shows one example that has an array of IBOutlet , but I can\'t figure out how to make Interface Builder connect multiple outlets to the same IBOutlet / IBOutlet Array. Has anyone figured out how to do this yet? I know that I can create 12

IBOutlet and IBAction

喜夏-厌秋 提交于 2019-11-26 00:27:35
问题 What is the purpose of using IBAction and IBOutlet in Objective-C coding for the iPhone, does it make any difference if I don\'t use them? 回答1: IBAction and IBOutlet are macros defined to denote variables and methods that can be referred to in Interface Builder. IBAction resolves to void and IBOutlet resolves to nothing, but they signify to Xcode and Interface builder that these variables and methods can be used in Interface builder to link UI elements to your code. If you're not going to be