iboutletcollection

How Can I orderly arrange items in Referencing Outlet Collection automatically?

狂风中的少年 提交于 2020-01-02 06:57:08
问题 I have Referencing Outlet Collection of UITextfields arranged in Xib as one below another. When I print Referencing Outlet Collection I found that its orderless. I need to automatically arrange text fields, ie text fileld comes 1st in UI should appear 1st in Outlet Collection Array. Any idea? 回答1: This is an unfortunate fact of IBOutletCollection . You may want to dupe rdar://12121242. You can set a tag for each view in IB, and then sort the collection by tag . You can also sort the

How to connect 3 UIButton to one outlet

只愿长相守 提交于 2019-12-23 19:13:38
问题 I try to do something like this @IBoutlet var buttons : [UIButton] but I can't drag button to this outlet Any idea, how can I achieve that? 回答1: It's possible to do that. Here is how: Create an array of IBOutlets Add multiple UIElements (Views) in your Storyboard ViewController interface Select ViewController (In storyboard) and open connection inspector There is option 'Outlet Collections' in connection inspector (You will see an array of outlets there) Connect if with your interface

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.

Set Individual Title of UIButtons in IBOutletCollection

倾然丶 夕夏残阳落幕 提交于 2019-12-23 05:20:03
问题 Does anybody know how to set the title of each individual button in an array of buttons using an IBOutletCollection? This is what I have tried, but the code sets the title of all the buttons. I have connected the outlet to the buttons and set their respective tags. .h file @property (nonatomic, retain) IBOutletCollection(UIButton) NSArray *buttonCollection; .m file - (IBAction)switchAction:(id)sender { for (UIButton *btn in buttonCollection) { if (btn.tag == 0) { [btn setTitle:@"1st Button"

Renaming class causes IBOutlet connection to fail

泄露秘密 提交于 2019-12-13 15:24:12
问题 I renamed a class, which happened to have an outlet connection to a label called mainLabel in a storyboard file. When I run my program, it crashes and gives me the error: "this class is not key value coding-compliant for the key mainLabel". Other SO answers have shown this to be caused by a bad outlet connection, so I removed the connection and removed any lose ends. When trying to reconnect the label to an outlet in my code, I get the error Could not insert new outlet connection: Could not

Can I connect multiple objects with different tags to the same IBOutlet?

偶尔善良 提交于 2019-12-09 17:28:05
问题 I have 30 buttons in one view in Interface Builder. Each has a different tag between 100001 and 100030. I've found it easy to use the same action for each button, passing along the tag for each one when pressed and using code to decide which level to load. I want to connect all the buttons to a single IBOutlet, but have each button load a different image based on the user's saved data and the button's tag. How do I do this? 回答1: Use IBOutletCollection to add an outlet collection to your view

How to make IBOutlets out of an array of objects?

佐手、 提交于 2019-12-08 23:20:45
问题 I want to make an array with a bunch of UIImageViews I have in Interface Builder. Instead of having 20 or 30 IBOutlet UIImageView *img1; and linking them all that way, and then putting them into an array, is there a way to declare an array of IBOutlet UIImageViews? Just so I don't have so many declarations in my header file. 回答1: It is possible, it’s called outlet collection . This is the way to define an outlet collection: @property(retain) IBOutletCollection(UIImageView) NSArray *images;

iOS and mutable IBOutletCollections

梦想的初衷 提交于 2019-12-06 09:34:53
问题 I have the property: @property(nonatomic, strong) IBOutletCollection(UIView) NSMutableArray *allOpposition; which is wired up in IB to a bunch of subviews and synthesized. Later I have: - (void)willRemoveSubview:(UIView *)subview { [[self allOpposition] removeObject:subview]; // Crash occurs here. [super willRemoveSubview:subview]; } When the time comes to remove the view representing an opposing entity, I get the following error message: -[__NSArrayI removeObject:]: unrecognized selector

Can I connect multiple objects with different tags to the same IBOutlet?

拥有回忆 提交于 2019-12-04 04:50:42
I have 30 buttons in one view in Interface Builder. Each has a different tag between 100001 and 100030. I've found it easy to use the same action for each button, passing along the tag for each one when pressed and using code to decide which level to load. I want to connect all the buttons to a single IBOutlet, but have each button load a different image based on the user's saved data and the button's tag. How do I do this? Use IBOutletCollection to add an outlet collection to your view controller, like this: @property (retain, nonatomic) IBOutletCollection(UIButton) NSMutableSet* buttons;

How to make IBOutlets out of an array of objects?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 08:07:54
I want to make an array with a bunch of UIImageViews I have in Interface Builder. Instead of having 20 or 30 IBOutlet UIImageView *img1; and linking them all that way, and then putting them into an array, is there a way to declare an array of IBOutlet UIImageViews? Just so I don't have so many declarations in my header file. It is possible, it’s called outlet collection . This is the way to define an outlet collection: @property(retain) IBOutletCollection(UIImageView) NSArray *images; Now you can stick more than one object into the outlet in the Interface Builder, the array will be created for