How does an app work?

来源:互联网 发布:linux more 查找 编辑:程序博客网 时间:2024/05/21 08:39

On iOS, apps are event-driven, which means that the objects listen for certain events tooccur and then process them. As strange as it may sound, an app spends most of its timedoing... absolutely nothing. It just sits there waiting for something to happen. When theuser taps the screen, the app springs to action for a few milliseconds and then it goes backto sleep again until the next event arrives.

Your part in this scheme is that you write the source code that will be performed whenyour objects receive the messages for such events. 


In our app, the button’s Touch Up Inside event is connected to the view controller’sshowAlert action. When the button recognizes it has been tapped it sends theshowAlertmessage to our view controller. InsideshowAlert, the view controller sendsthe show message to theUIAlertView object. Your whole app will be made up of objects thatcommunicate in this fashion. 


原创粉丝点击