开发者

adding an invisible button to the background in IB

开发者 https://www.devze.com 2023-02-11 18:35 出处:网络
I\'m working with Xcode doing a Ipad app. i simply want user to click anywhere on screen (not counting text fields) to perf开发者_如何学运维orm some IBAction.I\'m using an invisible button that covers

I'm working with Xcode doing a Ipad app. i simply want user to click anywhere on screen (not counting text fields) to perf开发者_如何学运维orm some IBAction.I'm using an invisible button that covers my whole view. Since I have some text fields in my view,i need to add this invisible button to the background of my user interface. I cant seem to find this option in the button attributes? any help?


Just set the button's type to custom.


Did you try setting the opacity of the button to zero?


I guess i got your point. You just want to put the UIButton(invisible) on the back of all the UITextField. The simple solution to this is open the Document Window in the IB. Now expand the view tree in the list view. Just drag your UIButton above the UITextFields and set the alpha value for the button in the property to be zero.

Hope this helps!!


iPad users don't "click". They "tap" or "touch".

In Interface Builder, I believe views are constructed with a z-index from top to bottom as they appear in the document window, so dragging your button so that it appears as the first subview of your main view should be a quick fix for this.

Have you considered other approaches? This doesn't sound like standard behaviour for an app and will probably cause havoc with anybody using Voice Over. What are you trying to accomplish?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号