标签: iboutletcollection

如何自动在Referencing Outlet Collection中有序排列项目?

我将Uibextfields的引用Outlet集合排列在Xib中,一个在另一个下面.当我打印Referencing Outlet Collection时,我发现它是无序的.我需要自动排列文本字段,即文本fileld在UI中排在第1位,应该在Outlet Collection Array中出现第1位.任何的想法?

iphone uitextfield iboutletcollection

3
推荐指数
1
解决办法
1358
查看次数

Label类型的Outlets数组

我有16个奥特莱斯变量.

@IBOutlet var label00: UILabel?
@IBOutlet var label01: UILabel?
@IBOutlet var label02: UILabel?
@IBOutlet var label03: UILabel?
@IBOutlet var label10: UILabel?
@IBOutlet var label11: UILabel?
@IBOutlet var label12: UILabel?
@IBOutlet var label13: UILabel?
@IBOutlet var label20: UILabel?
@IBOutlet var label21: UILabel?
@IBOutlet var label22: UILabel?
@IBOutlet var label23: UILabel?
@IBOutlet var label30: UILabel?
@IBOutlet var label31: UILabel?
@IBOutlet var label32: UILabel?
@IBOutlet var label33: UILabel?
Run Code Online (Sandbox Code Playgroud)

我想将它们声明为数组但不知道如何操作.

uilabel iboutlet ios iboutletcollection swift

3
推荐指数
1
解决办法
1576
查看次数

如何将 3 个 UIButton 连接到一个插座

我尝试做这样的事情 @IBoutlet var Buttons : [UIButton]

但我无法将按钮拖动到此插座

任何想法,我怎样才能实现这一目标?

xcode ios iboutletcollection swift

3
推荐指数
1
解决办法
1847
查看次数

在UIViewController viewDidUnload中是否应将IBOutletCollections设置为nil?

我的UIViewController类有一个包含几个IBOutlet对象的IBOutletCollection.我知道需要在viewDidUnload中将保留的出口设置为nil,但是我是否还需要将IBOutletCollection设置为nil?或者它应该在dealloc中被释放?还是完全独自留下?

uiviewcontroller ios iboutletcollection

2
推荐指数
1
解决办法
372
查看次数

设置IBOutletCollection的图层属性

我正在尝试设置连接到IBOutletCollection 的多个按钮的图层属性,但IBOutletCollection不允许我访问UIButton.layer与常规操作相同的按钮IBOutlet.

接口文件:

@property (strong, nonatomic) IBOutletCollection(UIButton) NSArray *customButton;
@property (weak, nonatomic) IBOutlet UIButton *myButton;
Run Code Online (Sandbox Code Playgroud)

实施文件

myButton.layer.cornerRadius = 9; // this works for individual buttons
customButton.layer.cornerRadius = 9; //This doesn't work for the collection of buttons
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?我是否需要做其他事情来调整集合的图层属性?我已将QuartzCore导入到我的实现文件中.

我只是试图在集合中添加4个按钮,所以如果我必须单独设置每个按钮,它不是世界末日,但能够将它们组合在一起会很好.

xcode objective-c iboutlet iboutletcollection

2
推荐指数
1
解决办法
399
查看次数

Xcode 5.1中的IBOutletCollection

我想IBOutletCollection在我的应用程序中创建一个控件列表.所以我在我的Document.h定义了以下出口:

@property (strong) IBOutletCollection(NSControl) NSArray *myControls;
Run Code Online (Sandbox Code Playgroud)

在早期版本中,Outlet Collections确实显示在Xcode中的相应Inspector中,但在Xcode 5.1中似乎并非如此.

出口集合之前

在此输入图像描述

在我的情况下,检查器中没有可见的出口集合:

在此输入图像描述

如何重新启用此行为?

macos xcode cocoa objective-c iboutletcollection

2
推荐指数
1
解决办法
159
查看次数

从Swift中的IBOutletCollection获取一个项目

我收到一个错误,因为"没有更多上下文,表达的类型是模糊的"

这是我的代码

@IBOutlet var customerDashboardButtons:[NSArray]?

var predicate = NSPredicate(format: "SELF.tag == %d", tag)
var filteredButtons = customerDashboardButtons!.filter { predicate.evaluateWithObject($0) };
if 0 < filteredButtons.count {
      var button = customerDashboardButtons!.first
      button.hidden = true // getting an error in this line as "Type of expression is ambiguous without more context
 }
Run Code Online (Sandbox Code Playgroud)

我试过以下,

var button:UIButton = customerDashboardButtons!.first //Error "NSArray? is not convertible to UIButton"

var button = customerDashboardButtons!.first as UIButton //Error "NSArray? is not convertible to UIButton"
Run Code Online (Sandbox Code Playgroud)

对此有任何帮助表示赞赏.

uibutton ios iboutletcollection swift

1
推荐指数
1
解决办法
3014
查看次数