Skip to main content

iOS: starting it up


iOS and MacOS programming is based on objective-c, an object based increment of C which apple has created and maintained.

Objective-C has the many advantages over c when it comes to memory management, object defining. Although similar in spirit to c++, it is completely different syntactically as well as in implementation.

Objective-C has two files for every program: an interface file(*.h files) and an implementation file (*.m files)

The interface file has the declaration of the variables, properties and the methods.

In Objective-C, the process of calling a method is called passing messages.


iOS programming

iOS is an event based programming environment.

Views are the user interface, the glass pane of the app.

Controllers push data and images to the views and also collect user interaction data from the views. Controller is responsible for the apps behaviour. 

Model is the source of data or it is a data-store.




In the view and controller, there are different components:

1. Actions: a method/function linked to an event, such that the event will start the execution.
The return type of the method should be IBAction and the parameter should be sender.

  1. - (IBAction)restoreDefaults:(id)sender;
 
The IBAction keyword lets the storyboard identify the method to be an action method and shows in the list of methods to be linked to events. 
sender object refers to the object which triggered the event.

2. Outlets: a way to interact with the UI elements from the code.

Outlets are defined as properties in the interface file (.h), they are then used in the implementation file with any methods.

  1. @property (weak, nonatomic) IBOutlet UITextField *textField;
 
we can use the textField pointer to access the values and fields of the corresponding textfield element in the UI

3. Controls: UI elements which are used for controlling the flow, e.g: buttons, sliders, switch, etc.,

There are 3 categories of controls: Touch & drag events, editing events and value changed events.

4. Navigation controls: navigate between different views or pages within an app. (UINavigationController)

----------

(Main.storyboard) Storyboards can be used to define navigation, link between pages.

Create different views and link then using segues, which denote an event which triggers the transition from the current view to the next view.
Several types of Segues include:
1. Show: display new data in the existing view based on the layout.
2. Show detail: replaces the content in the current view controller stack. not all content may be replaced.
3. Present modally: one view controller presenting another controller modally, and waiting for an user action.
4. Popover Presentation: a view controllers is presented as a popover, linked to the current view controller.
5. Custom: implement by extending UIStoryBoardSegue
6. Unwind: reverse navigation.



Comments

Popular posts from this blog

Tobi is not Madara Uchiha and that is my verdict.

1. Zetsu’s Approach Zetsu keeps the name Tobi and he is the only person who is very close to Tobi, since he is a spy and has the most information in the entire Naruto universe, he exists everywhere planted beforehand blended with the environment. Zetsu also wonders how much Kabuto knows about them, in vary tone. They’ve got something to hide other than their fighting powers. Kabuto already knows most of their secrets which they’ve got hidden even from Akatsuki members to avoid an internal clash for power. 2. Tobi’s awe of Kabuto’s Re-animation. Okay, this is very very intriguing. Madara Uchiha is afraid of something; it’s also a very best kept secret. since Kabuto promises that he hasn't told a soul. Madara who can analyze and formulate any jutsu asks “how did you do this?” Who is he afraid of, let us think back, He is not afraid of anyone. He has had only reverence for Hashirama, even then it cannot be first or the second Hokages since they were sealed by the third H...

Working!! is fun and satisfying

Working!! is an anime about the interesting things that happen in a family restaurant called Wagnaria, primarily about the staff that work there. Every character is quirky in someway or the other and it makes for some good comedy and drama. I’d like to go over the characters in the series in the order of their importance and talk about how I feel about them. Taneshima Popura: Taneshima is a high school senior who is very short, she is confused for an elementary student most of the time.  She is very upbeat and works hard, but has a huge complex about her height and is sometimes pranked upon by fellow workers in Wagnaria. Takanashi Souta: Takanashi is a junior to Taneshima and is recruited by her to work in Wagnaria at the start of the series. He likes all things tiny and deeply adores Taneshima.  He is level headed most of the time and works hard. He has three elder sisters and one younger sister whom he has to ...

Recently executed queries in SQL Server

To find out what all queries were executed recently in a sql server database, use the following queries Specific database: SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.* FROM sys.dm_exec_query_stats AS deqs CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest WHERE dest.dbid = DB_ID(' msdb ') ORDER BY deqs.last_execution_time DESC   All Databases: SELECT deqs.last_execution_time AS [Time], dest.text AS [Query] FROM sys.dm_exec_query_stats AS deqs CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest ORDER BY deqs.last_execution_time DESC