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

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  

Mundasupatti - a fun movie

I saw a movie the other day called Mundasupatti, I’m sure you’ve heard of it if you’re in Tamil Nadu. It was funny, they took a simple superstition which is around and made a fun movie out of it. It was a period film, exploring the 70’s of rural India. I was instantly reminded of swades, a great hindi film which again explores the development gap between cities and villages, it goes a bit further to compare development as seen by an Indian NASA engineer and his old house-hold nanny’s village.  While Swades was a serious film about self empowerment and braking society’s rules about casteism and encouraging education, Mundasupatti is just a funny movie about how stupid, people are.  The movie revolves around a village after which the film is named, the people in the village believe that taking a photograph causes people to get sick and die. The movie did a faithful representation of the rural India, with its proud people and crazy traditions which make no sense. People...

Apache Nutch-Solr Integration

Apache Nutch-Solr Integration   As of this writing, I am using Solr 4.8.0 and Nutch 1.8.0 binaries for the integration. Will catch up to later versions as and when my project requires. We can cover installation and operation of Solr and Nutch separately and then talk about the integration. the version of Nutch that I am using is very closely built with Solr and the integration is very simple. For simplicity sake, Ill stick to Linux environment for both as Nutch does not operate in windows natively. Getting Solr to work 1. All you need to for Solr to work are the binaries. you can get them from their  official page  (version 4.8.0) 2. Extract the  solr-4.8.0.zip  in some location. for this tutorial, lets assume that its in  /home/test/Research/solr 4.8.0/ 3. Open terminal, navigate to  /home/test/Research/solr-4.8.0/example/  and execute the following command to start solr server java -jar start.jar  4...