In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you the "iOS11 application view beautification button how to achieve the button response", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "iOS11 application view beautification button how to achieve button response" this article.
The button is mainly for user interaction, that is, the response. Buttons can be divided into two ways according to the difference of adding buttons: one is to add the response of the button in the editing interface, and the other is to use code to add the response of the button.
1. Edit the response achieved by adding buttons in the interface
Using the editing interface to add buttons, you can drag to achieve the response of the button, it is also the easiest way to achieve the response.
[example 2-4] the following will realize the function of tapping the button to change the background color of the main view. The specific steps are as follows:
(1) create a project of type Single View App template, named UIButton-response.
(2) Open the Main.storyboard file, drag the button control from the view library to the main view, and set Title to Tap me,Change View Color.
(3) use the three view icons of the settings editor to adjust the interface of Xcode to the effect shown in figure 2.5. This process is explained in the previous chapter.
Figure 2.5 adjust the interface of Xcode
(4) hold down the Ctrl key to drag the button object in the interface, then a blue line will appear and drag the blue line to the blank space of the ViewController.swift file, as shown in figure 2.6.
Figure 2.6 hold down the Ctrl key to drag the button object in the interface
(5) after releasing the mouse, a dialog box for declaring associated socket variables will pop up (explained in the previous section), as shown in figure 2.7.
Figure 2.7 Pop-up dialog box declaring associated socket variables together
(6) set the Connection option to Action to indicate that an action is associated, and set Name to tapButton to indicate that the associated action is named tapButton, as shown in figure 2.8.
Figure 2.8 fill in the dialog box
Note: the Name here can be arbitrary.
(7) Click the Connect button and you will see the code shown in figure 2.9 in the ViewController.swift file.
Figure 2.9 Action
The above is all the content of the article "how to beautify the button in iOS11 application view". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.