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)