Monday, November 28, 2011

Web development: What is DEBOO?

DEBOO is a small Development Enviroment which is based in a Oriented-Object Languaje like Java. What does it mean? It means You can create any class You want, to implement its methods and instances to use it in a small proyect and to understand how a POO language works. You could save it into your profile, to execute your codes, to test the result of those codes. Now after to be developed for mobile platforms, It's available from the website Visit and try it: DEBOOApp


Monday, October 24, 2011

Close temporally

Temporally, this blog is going to be inactive. I hope to reactivate it as soon as I can.


Wednesday, September 28, 2011

Do you know Objective-C? UITextField



Today we are going to learn how to use UITextField and how we have to do if we want to share data between two or more views.
To begin with, UITextField is no more than a place where we can write anything by using keyboard, to use any action with it.  If we want to use a UITextField, we have to know we need a method to display the keyboard to setting UITextField. Also, the UITextFieldDelegate protocol defines the messages sent to a text field delegate as part of the sequence of editing its text. This is why we set the UIView as delegate of the UITextField. We get it by creating the following method:


We use two UITextField with our UILabel which will show UITextField's contents. For this example we use a button to hide the keyboard, but it can be designed to have to whatever behavior its.


The method resignFirstResponder makes the UITextField loses focus and hides keyboard. After actions and objects have been designed we can set the NIB file.


We design a navigation bar with a button which makes to lose focus to the selected UITextField and then, textFieldDidEndEditing will be called to set the UILabel. Also we link the keyboard method when UITextField Did End On Exit like is showing in the past image.


By last, if we want to share data between two UIViews, we have to instantiate a objet of AppDelegate like this:  (iAccesoAppDelegate *)[[UIApplication sharedApplicationdelegate]. Also we have to set the shared data with @property as readwrite and copy. With this, we are setting the UIApplication as delegate of our View where we can have shared data, and both could access to them.

Tuesday, September 27, 2011

iAccess: First screenshots


My first App for iPhone is a simplified menu based in direct access which will be set with  a default group of accesses and, they could be edited like user wants.
Followed this, some screenshorts of the App which is going to be available in Apple Store soon.


               




Thursday, September 22, 2011

Do you know Objective-c?: How navigate in UITableView

As we saw how we can define a UITableView, set its properties and personalize it, now we are going to learn how to navigate in our UITableView designed in the post which we talked about UITableView, which we customize with two rows and sections that depended by the contents of array.
At first we have to define the UINavigationController in one of our events: ApplicationDidFinishLaunching. We do it like that:


After this, we have to add a UIViewController to our project which will be personalized with a method of writing in a UILabel and change it with a UIButton like our 'HelloWorld' example.


We have to select the correct subclass for our code:











We continue adding variables and methods to the new class we have created. We define an UILabel, UIButton with their respective methods set them in files .h & .m


The appearance of our new View will be customized with a button and a label as we said.


By last, we have to add what happens when a row was select. We had two arrays, that's why I evaluate what section I select it.


After all, we obtain a simple application like this:




Monday, September 19, 2011

Do you know Objective-c? Properties

I started publishing posts by forgiving a feature of Objective-C really usefull for our application development allow us to generate automatically getters/setters. Also we usually have to think that our code have to be straightforward and it could be generalized. Properties are a kind of virtual member variables which offer us all we have said. This is what it look without use properties:


After we use properties in our code, it seems like this:


The word "retain"in parenthesis the setter function: it should retain the input value. Rest of the line specifies type and name of the property. After this, the class definition as follow:


We can use setter an getter methods which are generate by the @synthesize directive. This directive is used to instantiate the property Also we use the dot syntax to set or get a value as we used.
With this example, we see properties are so powerful feature to use in our software developer. Next post will explain the attributes that a property can be have.


Monday, September 12, 2011

Do you know Objective-c? UITableView

Today we will see what is a UITableView, how define it and do a customization of them. UITableView is not more than a simple view of a list of information. We start defining a UITableView object in .h file of our proyect.
Later, to define it, mandatorily, we have to define methods that define basic properties of TableView, that in this case, will be the number of rows&sections that contain, and generate cells that contain the rows. The methods are:

We define the number of sections in UITableView, number of rows, and we access to cells's rows, initializing if necessary. Also, we add text to cell. With it we obtain a table, with two sections and two rows for each section with the word "prueba" that will be displayed.
After know basic operation of TableView, we can do a customization type  basic and usefull of it.
We can define names of headers and footers of sections,  define a determinate content for each section, with a array of objects (text, images, views, etc...). For it, we have modified the methods numberOfRowsInSection to give back the array content. We have create titleForHeaderInSection, that generate a title in fuction of the section and the method cellForRowAtIndexPath where the title for each cell will be the content of array depending of section. We haven't to forget add NSArray objects to .h file to our proyect. Finally, as it show in the video, we can see the result.




Sunday, September 4, 2011

Do you know Objective-c? UIApplication&UIView

Today we will see essential elements that make up all iPhone application and will serve as a base to mount your application (actions and appearance): UIApplication and UIView

I) UIApplication: 
UIApplication is, the entry point of the application, and is responsible for initializing and displaying a UIWindow, uploading this to load the first view (UIView). UIApplication manages the lifecycle of the application, using the UIApplicationDelegate, which manages the events received by the UIApplication. An example of events would start the application, close it, when a call is received while application is running, etc... So the events to handle are:
  • WillChangeStatusBarFrame: It will change the frame of the status bar.
  • DidChangeStatusBarOrientation: Change the orientation of the status bar.
  • WillChangeStatusBarOrientation:duration:It will change the orientation of the status bar and the duration parameter indicates how the animation will last. 
  • AandleOpenURL: Tells the delegate who wants to open a URL.
  • ApplicationDidBecomeActive: When the app is interrupted for whatever reason, will run in time to end this interruption.  
  • ApplicationDidFinishLaunching: Runs when the application has finished loading.
  • ApplicationDidReceiveMemoryWarning: When the device will run out of memory reaches, giving a "second chance" to free up space.
  • ApplicationSignificantTimeCharge: Runs to a significant change in the time during the performance of your application.  
  • ApplicationWillResignActive: Runs to a significant change in the time during the performance of your application.
  • ApplicationWillTerminate: Runs before it goes do idle.
  • ApplicationDidEnterBackground: The application will go into the background but if the application does not have multitasking implemented this method should save the state of the application, freeing the memory as it is on "pause" in the background when the user re-enters be in the sate in which it was but when in this "pause" if the memory the OS needs to close.
  • ApplicationWillEnterForeground: The application returns to the fore.
 II) UIView: 
 For each interface file .xib which has a UIView, will correspond to the handler classes .xib. UIView inherits UIView and will manage everything related to the associated view. UIViewController also manages the life cycle of UIView with the following events:
  • didReceiveMemoryWarning: When the controller receives a notice of memory. 
  • DidRotateFromInterfaceOrientation: Called after the view has rotated. 
  • WillRotateToInterfaceOrientation:duration: Called when the view starts to rotate, the duration indicates how long will it take to rotate.  
  • ViewDidAppear: Called after the view has emerged.  
  • ViewDidDisappear: Called after the view has disappeared.  
  • ViewDidLoad: Called after the view has been loaded into memory. 
  • ViewWillAppear: It is invoked just before the view appears. Is invoked just before the view disappears. 
  • WillAnimateFirstHalfOfRotationToInterfaceOrientation:duration: Runs before the rotation of the firs half of the interface and the duration will last.
  • WillAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: Runs before the rotation of the second half of the interface and the duration will last. 
Now we know the basic operation of a UIView and UIApplication, we will see ViewTableController and ViewTable, which will be useful to develop a set of views to "surf" for our app.

Sunday, August 28, 2011

Do you know Objective-c?: What is Cocoa?(II)

As we saw in the last post, then shows a video as a practical example, showing the structure that must follow to the design pattern MVC.


Because even I do not have audio on videos, as a clarification, the video content is summarized in the following diagram, where the project subdivide the three logical divisions that we saw in the MVC pattern.


-Belonging to the Model, Class CalculadoraBrain, will be declared the ivariables* and methods of operation (pulsed operation store, store digit, etc...).
-Belonging to Controller, CalculadoraViewController class, vriables are declared IB (Outlet and Action), which correspond to actions that may be given in the View, Model and methods that correspond performed at each time.
- Belonging to the View will generate the elements of the GUI of our application, linking these elements to events and actions to be taken for control

*ivariables: instance variables.


Thus, as we see, bind our three logical parts of our calculator, achieving independence and stability.

Friday, August 26, 2011

Do you know Objective-c?: What is Cocoa?

It's important to know what is Cocoa like concept and what involves. It is a basic concept to the start time to programming in Objective-C. Cocoa is, itself, a set of object-oriented frameworks that will allow the development of applications in different settings available in Mac OS X.
Once seen what is Cocoa, we know that, for developing applications with Cocoa, it is also necessary to know the concept of MVC (Model View Controller), which is nothing more than a modular design based pattern by which we can made to divide application logic into Model, View and Controller. Thus, the unit code in each design achieves stability and independence from the rest not being affected by changes on the code of other units.
The following are the characteristics of each of the modules of this pattern:

I) Model:
The model portion defines your application's underlying data enguine and is responsible for maintaining the integrity of data. Features:
  • It is usually a simple subclass of NSObject, or an instance of NSManagedObject to CoreData.
  • Contains a set of instance variables in which stores data.
  • Contains methods to access those instance variables.
  • Contains methods to generate object instances of other classes.
  • Contains a dealloc method (see its useful later).
  • It may contain methods for the modification of the internal object models.
  • It is reusable.
II) View:
The view portion defines the user interface for your application and has no explicit knowledge of the origin of the data displayed in that interface. Features:
  • Contains a NSView subclass.
  • Contains a drawRect method, which will form the basic of all methods of 'drawing'.
  • It can be a subclass, but rarely is the case.
  • Makes excessive use of Delegates for graphic.
  • It is reusable.
*Delegate: a delegate is a "connection" between objects, which allos the passage of messages in response to an event. We shall see later how to implement them in Cocoa.

III) Controller:
The controller portion acts as a bridge between the model and view and coordinates the passing of data between them. Features:
  • Intermediary between the view and model.
  • It is usually a subclass of NSObject.
  • Contains outlets and actions for IB.
  • Contains instance variables and collections to have and maintain model objects.
  • Available methods of handling and composition of model objects.
  • Contains the main method of awakeFromNib.*
*awakeFromNib: a method which comprises a protocol for recording information in the file window nib (NeXT Interface Builder). Classes can implement this method to initialize the state information after the objects have been loaded from the nib file.

Also, there is a dessing pattern called delegation, which is a way of modifying complex objects without subclassing them. Instead of subclassing, you use the complex object as is an object, which is referred to as the delegate object. At predefined times, the complex object then calls the methods of the delegate object to give it a chance to run its custom code.

Eveything has been explained in this post is resumed thanks to the following scheme



Wednesday, August 24, 2011

Do you know Objective-C? Start here

For those seeking a formal presentation of this programming language, can refer to http://es.wikipedia.org/wiki/Objective-C. For those who want to know the basic concepts, I can say that Objective-C is a programming language, currently used for programming on Mac OS X (iPhone,iPod,iMac), based on object orientation and regarded as a 'hybrid' between languages as well known as Java and C++.
Knowing this, we'll see basic concepts of programming in Objective-C to be compared perhaps with a language closer, such as Java and C++.

I) Classes
Classes in Objective-C are similar to those generated in C++, separating interface from implementation, thus disposing of headers methods and variables in a file, and in another implementation. In Objective-C interface file will have .h extension and implementation file will have .m extension.
Before meeting any class, is essential to understand the concept of IOBOutlet and IBAction. Both are macros defined to refer to variables and methods (respectively), which can be used in Xcode Interface Builder, that is, the way we connect visual elements with the functionality of the application. Some of these variables can refer to objects like buttons, tables, labels, switches, etc...


II) Methods
To tell if a method is a class method or instance, a particular symbol will be used in the method header.
+: This is a class method (access to variables of the class).
- : This is an instance method (access to variables with value determined for each class instance).

Examples:

- (void) updateCoordinateX(int coord_x);        //Objective-C
public void updateCoordinateX(int coord_x);  //Java
__________________________________________________________________________________

- (void) updateCoordinateX: (int) coord_x Y: (int) coord_y;   //Objective-C
public void updateCoordinatesXY(int coord_x, int coord_y);  //Java
__________________________________________________________________________________

Using methods:
[satellite updateCoordinateX: nuevaCoordenadaX Y:nuevaCoordenadaY];  //Objective-C
satellite.updateCoordinateXY(nuevaCoordenadaX, nuevaCoordenadaY);   //Java
__________________________________________________________________________________

Nesting methods:
Satellite sat_1;                       //Satellite instantiate class object
sat_1= [[Satellite alloc]init];    //Reserve memory with alloc method and initialize the object attributes

II.I) Memory management methods:

An important point to note here, learning basic concepts of Objective-C, is that unlike Java, does not have a garbage collector that frees unused memory resources, so we must manage ourselves the process of allocating and freeing memory. To do this we have methods like ALLOCINIT and RELEASE.
  • ALLOC: Allocate memory for a particular object class that invokes it.
  • INIT: Initialization method attributes.
  • RELEASE: Release memory allocated to a class object.
With these basic concepts of Objective-C, and knowledge about the management of Xcode, we can develop a basic 'Hello World' as it shown in the video below.







Monday, August 22, 2011

First steps on Objective-C

After world of developing applications for mobile platforms Mac OSX called my attention, this blog turn up, where I will share my learning about Objective-C&Cocoa world and practical examples on the subject. Now, a week has passed since I got what it takes to star, and with the help of the documentation that Apple provides in his side http://developer.apple.com/, tutorials and other information circulating on the web, I mounted my fist App for Iphone, which is considered the advanced 'Hello world' in developing app for Smartphone. This is a simple calculator, with basic operations, with which I was able to refine the basic concepts and design patterns of App for Iphone.