How does the compiler know a button has been pressed?

virantporwal

I want to know the steps, or perhaps the algorithm, the compiler uses to know an event happened? For example, how does it know a button has been pressed?

JRG-Developer

The compiler doesn't know anything about events. The compiler just translates your high-level source code into machine code.

This is within the realm of the runtime, which is affected by the operating system (iOS), controllers (view controllers) created by you, etc.

iOS uses the concept of "run loops" to process and handle events. Every iOS app will always have at least one such run loop, designated the "main" operation queue/thread, and possibly several in a multi-threaded app.

In a nutshell, the main run loop works kinda like this:

  1. Run loop starts
  2. Input sources (i.e. via user interaction, timer events, etc) deliver events to corresponding event handlers on the run loop- this may result in an IBAction (a method created by you) being called, for example
  3. Processing and event-caused actions take place (i.e. running your IBAction code)
  4. Towards the end of the loop, reference counting tasks happens (autoreleased objects get released, etc)
  5. Run loop ends
  6. Run loop may then repeat (as in the case of main)

For more information, you should read Apple's documentation on Run Loops.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to know what push button has been pressed?

From Dev

how to know if a button has been clicked in javascript?

From Dev

How to notify an Activity that the back button has been pressed in a Fragment?

From Dev

How to notify an Activity that the back button has been pressed in a Fragment?

From Dev

How to reset error message after button has been pressed?

From Dev

How do i remove a item from a Listbox when it has been chosen and a button has been pressed

From Dev

how does compiler know that the class being used is a generic one although it has been compiled and its type erased to pre-generic code

From Dev

How does browser know how much page has been loaded?

From Dev

How does Rails know that a migration has been up'ed/run?

From Dev

How does the CLR know if a static field has already been initialized?

From Dev

How does GDB know where an executable has been relocated?

From Dev

How does Windows Defender know that an antivirus has been installed?

From Dev

How does dpkg know that a config file has been deleted?

From Dev

How does the CLR know if a static field has already been initialized?

From Dev

How to find which Image Button has been pressed when using Server Validate

From Dev

How can I add row of components to a GUI when a button has been pressed?

From Dev

How to invoke PHP form fields validation only after the "send form" button has been pressed?

From Dev

How do i tell my UIView that the button in UIViewController has been pressed? (Swift)

From Dev

Apache Wicket : Update value of the Label after the Button has been pressed

From Dev

Check if the button has been pressed after js submit

From Dev

C# WPF Pause processing until button has been pressed

From Dev

Allowing a button to be pressed when control has been passed away

From Dev

Fade <div> element after submit button has been pressed

From Dev

Don't trigger the Jquery event after a button has been pressed

From Dev

How would I go about adding a button id so I can tell which button has been pressed in Rails

From Dev

How to know if a handle has been already initialized

From Dev

How to know if a PHAsset has been modified?

From Dev

How to know if "fputcsv" has been successfully executed

From Dev

How to know if a Git tag has been moved?

Related Related

  1. 1

    How to know what push button has been pressed?

  2. 2

    how to know if a button has been clicked in javascript?

  3. 3

    How to notify an Activity that the back button has been pressed in a Fragment?

  4. 4

    How to notify an Activity that the back button has been pressed in a Fragment?

  5. 5

    How to reset error message after button has been pressed?

  6. 6

    How do i remove a item from a Listbox when it has been chosen and a button has been pressed

  7. 7

    how does compiler know that the class being used is a generic one although it has been compiled and its type erased to pre-generic code

  8. 8

    How does browser know how much page has been loaded?

  9. 9

    How does Rails know that a migration has been up'ed/run?

  10. 10

    How does the CLR know if a static field has already been initialized?

  11. 11

    How does GDB know where an executable has been relocated?

  12. 12

    How does Windows Defender know that an antivirus has been installed?

  13. 13

    How does dpkg know that a config file has been deleted?

  14. 14

    How does the CLR know if a static field has already been initialized?

  15. 15

    How to find which Image Button has been pressed when using Server Validate

  16. 16

    How can I add row of components to a GUI when a button has been pressed?

  17. 17

    How to invoke PHP form fields validation only after the "send form" button has been pressed?

  18. 18

    How do i tell my UIView that the button in UIViewController has been pressed? (Swift)

  19. 19

    Apache Wicket : Update value of the Label after the Button has been pressed

  20. 20

    Check if the button has been pressed after js submit

  21. 21

    C# WPF Pause processing until button has been pressed

  22. 22

    Allowing a button to be pressed when control has been passed away

  23. 23

    Fade <div> element after submit button has been pressed

  24. 24

    Don't trigger the Jquery event after a button has been pressed

  25. 25

    How would I go about adding a button id so I can tell which button has been pressed in Rails

  26. 26

    How to know if a handle has been already initialized

  27. 27

    How to know if a PHAsset has been modified?

  28. 28

    How to know if "fputcsv" has been successfully executed

  29. 29

    How to know if a Git tag has been moved?

HotTag

Archive