从NIB获取UIButton实例(无交互)
我想知道如何获取 UIButton 的实例而不与其交互。我在我的 xib 中放置了一个按钮,只想能够获取它在代码中的位置。我创建了一个 IBOutlet 并将它们链接起来,但是当我查看 IBOutlet 的位置时,它被设置为 0,0。
非常感谢任何帮助。
亲切的问候, 埃利奥特
I was wondering how to grab an instance of a UIButton without interacting with it. I have placed a button in my xib, and just want to be able to get it's position in code. I have created an IBOutlet and linked them up, but when I look at the position of the IBOutlet it is set to 0,0.
Any help is much appreciated.
Kind Regards,
Elliott
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须设置该按钮的
tag
属性,例如 1001,例如在viewDidLoad
方法中,您可以通过以下方式获取该按钮:希望它可以帮助您...
you have to set
tag
property of that but button, say 1001, and for example inviewDidLoad
method you can get that button by :Hope it helps you...