Develop your own MacOS Lock screen software with Swift (3)

Source: Internet
Author: User

The first two implemented the MacOS side of the lock screen software, now need to implement a mobile app to achieve and Mac communication, the future article may be two of items interspersed.

After writing MacOS Software and then back to write iOS is really enjoy, looking at the mountains of various documents, cool Ah, then now write it

The first is to create a project, this is not much to say, after creating a good project, haha, write a Hello world.

Still dragging a label and a button,label is just beginning to show Hello IOS, and then clicking the button will show Hello World.

Unlike MacOS, the label modifies the text instead of the MacOS title, and then sets the font to 40, setting a constraint on the label so that it is centered horizontally and vertically. Click to run, because my phone is 6p, so the simulator select 6p, just at the beginning will be very large, my computer is small, need to reduce the simulator to 25% to see a little more beautiful

And then the same old drag, and then write the function, if you do not understand can look at the first article, I am here to intercept the dynamic diagram is difficult, it is not cut

It is important to note that the label changes shown here are not stringvalue, but rather change back to the most basic text

classViewcontroller:uiviewcontroller {@IBOutlet weak var namelabel:uilabel!@IBAction Func Changlabeltext (_ Sender:any) {Namelabel.text="Hello World"    }    Overridefunc viewdidload () {super.viewdidload ()//additional setup after loading the view, typically from a nib.    }    Overridefunc didreceivememorywarning () {super.didreceivememorywarning ()//Dispose of any resources the can be recreated.    }}

Done

Develop your own MacOS Lock screen software with Swift (3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.