How to add custom fonts to an iPhone app?

Hello Friends,

Once again coming with simple but important things.How we customize the fonts.

This is only available for SDK 4.0 and above.

1.Add your custom font files into your project using XCode as resources.

2.Add a key to your info.plist file called “Fonts provided by application” ( Used to be called UIAppFonts).

3.It’s an array key.

4.For each font you have, enter the full name of your font file (including the extension).

5.Save info.plist.

6.Now in your application you can simply call [UIFont fontWithName:@”CustomFontName” size:12] to get the custom font to use with your UILabels and UITextView.

7.“CustomFontName” is not the font’s file name. It is the font name registered in the operating system. For example, if you try to use “Bauhaus Medium BT.ttf”, the “CustomFontName” should be “Bauhaus Md BT”, no extension “.ttf” is needed. You need to install the font in your system to find out what name it is. Some fonts have 2 names, you may need FontForge to find out and try which one works.

8.So far I found out that both ttf and otf format work out of the box. I haven’t tested other font formats yet.


Object Oriented Concept for Beginner iOS Developer


This is very Basic Blog and Very important for those who want to start the Career in Mobile Technologies Specially in iOS. My First Advise is Please give enough time to understand OOP(Object Oriented Programming ) Concepts. Here I am also trying to Explain in sort. Please let me know if anybody has any kind of confusion or Query regarding this.

1.what is OOP?

OOP is a design p development philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self sustainable “objects“. Hence, you gain re-usability by means of four main object-oriented programming concepts.

In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.

2.What is an Object?

Objects are the basic run-time entities in an object-oriented system. They may represent a person,a place,a bank account or any item that the program has to handle. They may also represent user-defined data such as vectors,time and lists.

An object can be considered a “thing” that can perform a set of relatedactivities. The set of activities that the object performs defines the object’s behavior. For example, the hand can grip something or a Student (object) can give the name or address.


A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object. A class is the blueprint from which the individual objects are created. Class is composed of three things: a name, attributes, and operations.

 public class Student { }

According to the sample given below we can say that the student object, named objectStudent, has created out of the Student class.

 Student objectStudent = new Student();

In real world, you’ll often find many individual objects all of the same kind. As an example, there may be thousands of other bicycles in existence, all of the same make and model. Each bicycle has built from the same blueprint. In object-oriented terms, we say that the bicycle is an instance of the class of objects known as bicycles.

In the software world, though you may not have realized it, you have already used classes. For example, theTextBox control, you always used, is made out of the TextBox class, which defines its appearance and capabilities. Each time you drag a TextBox control, you are actually creating a new instance of the TextBoxclass.

4.Data Encapsulation:

Data encapsulation, sometimes referred to as data hiding, is the mechanism whereby the implementation details of a class are kept hidden from the user. The user can only perform a restricted set of operations on the hidden members of the class by executing special functions commonly called methods. The actions performed by the methods are determined by the designer of the class, who must be careful not to make the methods either overly flexible or too restrictive. This idea of hiding the details away from the user and providing a restricted, clearly defined interface is the underlying theme behind the concept of an abstract data type.The advantage of using data encapsulation comes when the implementation of the class changes but the interface remains the same

5.Data Abstraction:

The concept of abstraction relates to the idea of hiding data that is not needed for presentation. The main idea behind data abstraction is to give a clear separation between properties of data type and the associated implementation details. This separation is achieved in order that the properties of the abstract data type are visible to the user interface and the implementation details are hidden. Thus, abstraction forms the basic platform for the creation of user-defined data types called objects.Data abstraction is the process of refining data to its essential form.


Ability of a new class to be created, from an existing class by extending it, is called inheritance.


 public class Exception { } public class IOException : Exception { }

According to the above example the new class (IOException), which is called the derived class or subclass, inherits the members of an existing class (Exception), which is called the base class or super-class. The classIOException can extend the functionality of the class Exception by adding new types and methods and by overriding existing ones.

Just like abstraction is closely related with generalization, the inheritance is closely related with specialization. It is important to discuss those two concepts together with generalization to better understand and to reduce the complexity.


Polymorphisms is a generic term that means ‘one name multiple form‘. More precisely Polymorphisms means the ability to request that the same operations be performed by a wide range of different types of things.

At times, I used to think that understanding Object Oriented Programming concepts have made it difficult since they have grouped under four main concepts, while each concept is closely related with one another. Hence one has to be extremely careful to correctly understand each concept separately, while understanding the way each related with other concepts.

In OOP the polymorphisms is achieved by using many different techniques named method overloading, operator overloading and method overriding,

8.Dynamic Binding:

Binding refers to the linking of a procedure call to the code to be executed in response to the call.Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call run-time. it is associated with polymorphism and inheritance. A function call associated with a polymorphic reference depends on the dynamic type of that reference.

9.Message Passing:

An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language,therefore,involves the following basic steps:

1. Creating classes that define objects and their behavior ,

2. Creating objects from class definitions and

3. Establishing communication among objects.

objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate their real-world counterparts.

Some important Questions Regarding OOP’s concept:

What is Method Overloading?

The method overloading is the ability to define several methods all with the same name.

 public class MyLogger { public void LogError(Exception e) { // Implementation goes here } public bool LogError(Exception e, string message) { // Implementation goes here } }

What is Operator Overloading?

The operator overloading (less commonly known as ad-hoc polymorphisms) is a specific case of polymorphismsin which some or all of operators like +, – or == are treated as polymorphic functions and as such have different behaviors depending on the types of its arguments.

 public class Complex { private int real; public int Real { get { return real; } } private int imaginary; public int Imaginary { get { return imaginary; } } public Complex(int real, int imaginary) { this.real = real; this.imaginary = imaginary; } public static Complex operator +(Complex c1, Complex c2) { return new Complex(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary); } }

I above example I have overloaded the plus operator for adding two complex numbers. There the two properties named Real and Imaginary has been declared exposing only the required “get” method, while the object’s constructor is demanding for mandatory real and imaginary values with the user defined constructor of the class.

What is Method Overriding?

Method overriding is a language feature that allows a subclass to override a specific implementation of a method that is already provided by one of its super-classes.

A subclass can give its own definition of methods but need to have the same signature as the method in its super-class. This means that when overriding a method the subclass’s method has to have the same name and parameter list as the super-class’s overridden method.

 using System; public class Complex { private int real; public int Real { get { return real; } } private int imaginary; public int Imaginary { get { return imaginary; } } public Complex(int real, int imaginary) { this.real = real; this.imaginary = imaginary; } public static Complex operator +(Complex c1, Complex c2) { return new Complex(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary); } public override string ToString() { return (String.Format("{0} + {1}i", real, imaginary)); } }

In above example I have extended the implementation of the sample Complex class given under operator overloading section. This class has one overridden method named “ToString”, which override the default implementation of the standard “ToString” method to support the correct string conversion of a complex number.

 Complex num1 = new Complex(5, 7); Complex num2 = new Complex(3, 8); // Add two Complex numbers using the // overloaded plus operator Complex sum = num1 + num2; // Print the numbers and the sum // using the overriden ToString method Console.
WriteLine("({0}) + ({1}) = {2}", num1, num2, sum);

For More reading using Balaguruswamy C++ ebook click here.