An iPhone development tutorial from icodeblog.com.And it is also provided by the author with other tutorials. This tutorial is also allowed to download in the format of .pdf document, and please click here.
Thanks for his hard work and warmhearted!
In this tutorial I will create a simple “Hello World” application using a UITableView for the iPhone. There are many ways that a Hello World program could be made on the iPhone, but I am going to show you the simplest. This tutorial assumes you have a basic understanding of Objective-C. Apple has provided a very simple and straight forward tutorial on Objective-C. You can find it here.
This tutorial assumes that you have already installed the iPhone SDK. If you are unsure how to do this, click and follow the steps.
Creating a New Navigation-Based Application
Open Up Xcode
You will be doing all of your development in Xcode. Then close the Welcome window (if it shows up)
Start a new iPhone OS Project
Click Xcode > New Project and a window should pop up like this:
Make sure Application is selected under iPhone OS and then select Navigation-Based Application. Click Choose… It will ask you to name your project. Type in “Hello World” and let’s get started.
Learn About the Default Files
What is all this stuff? There are quite a few files that get added to your project. At first glance, this looks kind of intimidating. Don’t worry, we only need to edit one of them. Here is a quick explanation of the different files. You don’t have to read this part but having this many files is what confused me the most when I started developing for the iPhone.
CoreGraphics.framework, Foundation.framwork, UIKit.framework – You guessed it, this is a set of library functions provided by Apple that we use in our application. We use these as includes similar to any other language that includes library functions.
HelloWorld.app – This is your app that gets installed on the iPhone. We don’t really need to worry about this right now
Hello_World_Prefix.pch – This is another include file that gets compiled separately from your other files so you don’t need to include it on each file. It contains some code to include the data inside the frameworks.
Hello_WorldAppDelegate.h – This is a header file that contains all of our definitions for variables that we will be using. It’s very similar to a header file in C or C++;
Hello_WorldAppDelegate.m – All of the magic starts here. Consider this file our starting point for execution. The main.m file invokes this object.
Info.plist – This contains various meta information about your program. You won’t really need to edit this until you are ready to start testing on the iPhone
main.m – Like most programming language, this file contains our main function. This is where execution begins. The main function basically instantiates our object and starts the program. You shouldn’t need to edit this file.
MainWindow.xib – This contains the visual information of our main window. If you double click on it, it will open in a program called “Interface Builder”. We will get to this a little later. Just on thing to note is this file does not contain any code.
RootViewController.h, RootViewController.m - These are files for a view controller that gets added to our main window. Basically, Apple has already created a simple interface when you clicked on Navigation-Based Application. Since most navigation-based applications use a Table View, Apple has provided it for us to use.
RootViewController.xib – This is a view that Apple has provided that emulates a table. It has rows and columns. We will be displaying our “Hello World” text inside one of these rows
Now, all of these files together create a basic program. Go ahead and click on the Build and Go button at the top of Xcode. Make sure the drop-down on the top left says Simulator | Debug, this tells Xcode that we are testing on the iPhone simulator.
You will see the iPhone simulator start and your program will launch. It’s not very interesting at the moment. All it shows is the Table View that Apple has added for us. So what we are going to do is add a row to this table view.
Update the UITableView Cells to Display “Hello World” Text
Let’s write some code
Start by opening RootViewController.m. This is the view controller that Apple added to our main view. All of the functions you see already created in here are functions that have been overridden from the Table View super class. Since we are editing a table, all of these functions will be related to editing a table. So find the function called numberOfRowsInSection.
This function tells the application how many rows are in our table. Currently, it returns 0. Let’s change that to return 1. This will tell the application that we want 1 row in our table. Now go down to the function called cellForRowAtIndexPath. This function gets called once for every row. This is where we define what content to display in a given row. In this case we want the row to be a string that says “Hello World”.
What this function is doing is creating a new cell object and returning it. The code between the i(cell==null) block checks to see if we have created a cell before, if not build a new cell, otherwise use the one we created before. This helps in performance so we don’t need to build new cells each time we visit this function. So right before the // Set up the cell comment add the following code:
[cell setText:@"Hello World"];
We are basically calling the setText method of the cell object and pass in the string "Hello World". As you should know from reading Apples Objective-C overview, strings begin with an "@"symbol.
That's it! Click the Build and Go button again to launch the iPhone simulator. You should now see a screen like this:
You can now use this code as a base for creating a Navigation Based application. In a later tutorial, I will detail how to populate this table view with an array of strings to create navigation for a simple program. If you get lost at any time, you can download the sample code for this program here hello-world. I hope you enjoyed the tutorial and if you have any questions, feel free to leave them in the comments. Happy Xcoding!
An iPhone development tutorial from icodeblog.com
This tutorial is also allowed to download in the format of .pdf document, and please click here.
Thanks for the author's hard work and warmhearted!
This tutorial will detail all of the steps that you need to take to start developing native iPhone applications. After completing this tutorial, you should have all of the tools necessary to get started. Note this tutorial assumes that you are running Mac OS X v10.5.3 or later. If you are running a Windowz box and reading this tutorial, then step 0.5 is : Smash your Windowz box and buy a Mac, you’ll thank me later. Now on to the good stuff…
Sign Up For a Developer Account
Head on over to
Apple Developer Connection and sign up for a developer account. You can sign up for an account for free to be able to gain access to all of the tools and documentation. This will also provide you with a built-in iPhone simulator so that you can test your applications on your local machine. However, when you are ready to deploy your application on an iPhone, you must sign up for the iPhone Developer Program.
Get the iPhone SDK
Now that you have signed up for that, you will have access to the iPhone SDK, Documentation, Sample Code, and API. The first thing you want to do is download the iPhone SDK. This includes the latest version of XCode and contains the entire suite for developing iPhone applications. The installation is pretty strait forward. Just accept all of the defaults and you’ll be on your way
That’s it! If you were expecting something more complicated, then I am sorry to dissapoint. I have also, provided links to each of these sites in the sidebar of my blog for quick access. The next iPhone tutorial will show you how to write your first Hello World application.
Edited by suzvenus Our URL: http://www.suzvenus.com Professional iPhone application development webiste Our Dev Center Please click here
You can download the code from the TextFeildInAlert.zip which is also provided by author .
This tutorial is also allowed to download in the format of
.pdf document, and please click here.
Thanks for his hard work and warmhearted!
This will be a simple tutorial showing you how
to put a UITextField in a UIAlertView. This is simple
and just a couple lines if code. You will learn
CGAffineTransform and coding UITextField programmatically.
Heres a screenshots of what we should get.
So lets go ahead and get started…
1. Create A New View Based Application You can name it whatever you want, I will name it TextFieldInAlert.
2. Implementing The Code Jump in the viewcontroller.m or if you called it TextFieldInAlert then
TextFieldInAlert.m Now find the -(void)viewDidLoad method. Uncomment it and put this code in there.
- (void)viewDidLoad {
[super viewDidLoad];
UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@”Enter Name Here” message:@”this gets covered!”
So we are basically calling a UIAlertView and then we are adding the
UITextField programmatically. You might have noticed in the message
part of the UIAlertView we put “this gets covered!”, if we didn’t put that
sentence then the alerts buttons would go up more and the UITextField
will be messed. You can try taking that line out and see what happens.
Now Build and Run the app. Now you got the UITextField to be inside
the UIAlertView. Now try tapping the UITextField. Uh oh, why is the
Keyboard covering the UIAlertView? Well there is just a simple fix to
this. We just add two more lines of code and it will fix that. Add this to
your code
Now if you Build and Run, you will notice the UITextField is a little higher and
when you tap the UITextField the Keyboard doesn’t cover it up anymore.
That is what the CGAffineTransform was for. So that is basically it! There is
a video tutorial also available.
You can download the source code from here. Happy iCoding!
And you can download the code from the InApplicationEmailing.zip.
which is also provided by author, or click here. The tutorial is also allowed to download in the .pdf format from here.
Thanks for his hard work and warmhearted!
A lot of applications you see have an email button.
When you click it then it will leave the application and take you to
the Mail application. It can get really annoying leaving the
application and then going back in after your done sending the email.
his is just a great way to show off your app and make it look more
professional and make it easier on the user by filling in the To and
Subject for them. They are also able to change the From to whatever email then want you to
receive an email from just like you can do in the Mail app. So todays tutorial is gonna show
you how to email within your application. We will be using the MessageUI framework and
we will also include an attachment in the email. Theres a screenshot to the left of how it
will look. So lets get started…
1. Create A New View Based Application You can name yours whatever you want, in the tutorial I will be referring it as the
NameViewControllers.
2. Import The Frameworks
The first thing we need to do is import the framework. So go to your Frameworks folder
in the Files In Pain section on the left. Open the folder and right click one of the frameworks
and click “Reveal In Finder.” Heres a screenshot on what you should do.
Go ahead and look for the “MessageUI.framework” and highlight it then drag it into your
frameworks folder. Make sure that when you click Add on the thing that makes sure you
want to import it that “Copy items into destination group’s folder (if needed)” is not check.
Thats a very important step or you will have big time problems and you do this with any
frameworks you would ever use in the future.
3. Implementing The Code
Now that we have imported the framework lets get into some coding. So go ahead and
jump in the NameViewController.H and make an IBAction for a button. Then copy that code
and paste it in the NameViewController.M with curly brackets. Also make sure to add the
button in Interface Builder and link it up with a Touch Up Inside method. You guys are at the
point to knowing how to hook up actions and dragging stuff into Interface Builder.
After that we want to on the top of the NameViewController.h import the framework.
So on the top do #import “MessageUI/MessageUI.h”, the reason why we do this is because
we must import out MessageUI framework to make calls to the associated header files.
Now we need to also put in the delegate protocols for this framework. @interface
NameViewController: UIViewController do this code <MFMailComposeViewController
-Delegate, UINavigationControllerDelegate>.
-Heres the code here for the NameViewController.H
UIAlertView *alert = [[UIAlertViewalloc] initWithTitle:@”Message Failed!”message:@”Your email has failed to send”
-delegate:selfcancelButtonTitle:@”Dismiss”otherButtonTitles:nil];
[alert show];
[alert release];
}
}
What if we wanted to include an image attachment to the email?
Well its quite simple. Just add this to the code right under the part where you set up the
Recipient, Subject, and the Message.
Now we are setting up the MailComposer in the first part of the code in the action.
Then we call a didFinishWithResult method where we are setting up if the email fails or sends.
Also it sets up a Cancel button for you so we have to call the dismiss method so that it works.
In the attachment code just edit the imageNamed:@”" with your images name.That is basically
it! The source code is below for the people that just doesn’t wanna copy and paste or type…
Hi all, this is the last tutorial of these series of tutorials. You will still remember those question mark which were show on this page:
Step 1: Please Notice, on the first line, you will see the string "PHP", why did they change into the question mark? If you browse my blog, you will find out these links are the topics of my latest blog articles. Because the database character setting of the Squidoo.com is Latin, but not UTF-8. Some kinds of language character, such as Chinese, Japanese and Arabic can't be shown exactly, but be changed by question mark. So if I change my blog articles' title into English, they will be displayed normally just like this image:
Step 2 : After finishing the setting of blog RSS, we will set up a new text module, which will be shown in the high-visibility location. You can edit anything related to your website or products which will be publized. For example, now I will edit this module by a successful iPhone project Demo.
As before, you should click the edit button on the top right corner of the "New text module", and you will see this edit page:
At first you still need to enter the title and subtitle of this text module, then the description of this module is necessary. Maybe you should add a beautiful picture which is related to your website or products to this module in order to make it more attractive. Then click save button and you will see the rendering image like this:
Step 3 : The job is very interesting in this step. Because you are allowed to add some kinds of related commodity of Amazon.com into your lens. If guests are interested in your lens, they will browse these related commodities.
As before, we should enter the title, subtitle, description, then you can select to pick the proper commodities by yourself or by Amazon.com. If you choose the latter, the system will pick the proper commodities by your tags and keywords, sometimes you will find that some irrelated commodities are added into your lens. So I decided to pick the commodity by myself. The step is very easy and convenient. Click this amazon link : http://www.amazon.com or click here.
Then enter the commodity keywords which you want to search, then you will obtain a lot of related commodities links. Choose your favorite and add their links into the "Enter links or Amazon ASINs" textarea, please remember to add a link in one line, or they will be seemed as a long link. Then click the blue ADD ITEMS button, and you will see this page:
Step 4 : Now you may feel boring and tiring, in fact ,we should only little job to finish. Set up your flickr photos and show them randomly in your lens. Click the edit button and open the edit page:
Now I choose to make the system pick photos, because I have no time to find 10 related images. So I click the "Let Flickr Pick" radio option and enter my search tems, keep the default setting, then save this page, you will see the rendering image:
At this time you will see the congratulation page if you have saved all settings:
Then you can also modify and improve your lens by click its link in your homepage:
OK, it's time to say Goodbye to you for this tutorial. And it's the end of the series of Use Squidoo to Optimize Web 2.0 Website Tutorials, you can click these links to browse all English Tutorials:
Would you like to download these tutorials in the format .pdf?
You will click the Resource Center -> Download Center, and we will provide the download feed of these tutorials.
If you have any question about tutorials, please sent mail to us.
The new series of tutorials to be expected.
Please don't worry, our job is to make it more beautiful and useful. OK, now let's go!
The first job is to study what is the module. It seems as if it is very advanced and complex when you first hear of the module. In fact, it is very ordinary in your life. In the web 2.0 period, you may set up your own blog or other kind of homepage website. If you have registered your account and obtained the page model, you will find out that you should edit the text, upload your picture, change the background music and so on, only because the default modules are ugly or weak. The text edit area, picture shown software, background music player are all modules. These modules usually are provided by software or website itself, moreover, we can add some modules by ourselves.
In this tutorial, we only edit the default modules which are provided by the Squidoo.com. Now let me introduce the modules step by step.
Step 1 : Edit the first and most important module,which is named "Introduction, contents & discovery tool". You will introduce the total information of your lens, so you should make it attractive and useful. Observe this module and click the orange edit button on the top right corner. Then you will see this edit page:
You will see three Tabs : Intro Text, Table of Contents, Discovery Tool. Intro Text tab makes you to edit title, description and picture of your lens. Table of Contents tab makes you to choose whether turn on or off your modules in order to increase your click and revenue. Discovery Tool tab makes you to choose whether turn or off your discovery tool in order to find more great lenses and add some related lenses into your lens.
Now you can edit the title and description of your lens. It's very easy, but please remember to choose an attractive title for your lens. When others have never browsed your lens, it will be the first impression of your website and products. You should also add a proper image for your lens just like this page:
Click the UPLOAD PHOTO button and upload the images in your folder. PLEASE BE CAREFUL, the format of these images are only .jpg or .gif, the common .png format is not allowed. Then you can preview the picture at once, if you dislike it, delete it by clicking the REMOVE PHOTO button.
Click the Save button you can turn off this tab and turn on the other tabs. For example, just like this page:
In the Table of Contents lab, you are allowed to choose to turn on or off modules in order to make people to explore your page and bring more click and revenue. The default choice is off, but we should turn it on and select all modules in the table of contents. Click save button and turn on the last tab : Discovery Tool.
The default choice is turn on the discovery tool in order to find more great lenses, we did not modify it. Then you will ask to add your 3 favorite related lenses. Maybe you feel it is too hard to find other related lenses. Now I will tell you how to find them easily and quickly.
Open the homepage of Squidoo.com or click here, then you can enter the keywords of you own lens. For example, I will enter "iphone application" and click the Go! button. Choose your favorite lenses in the search result list and enter their suffix, click save button and then you will go to the step 2.
Step 2 : Add your blog to this lens. Click the Edit button and go to the edit page:
At first enter the title and subtitle of your blog, of course, some words description about your blog. Then enter the blog's URL and choose how many headlines would you like to show. The default choice is 3, and it means to show the latest 3 new blog articles. We don't need to be changed. Choose the frequency and visual HTML and keep the default choice. Then click the Save button, imagine what will you see?
But what does this question mark mean? It made me confused and puzzled. Do you know how to deal with this problem?
PLEASE WAIT FOR OUR NEW TUTORIAL : Use Squidoo to Optimize Web 2.0 Website Tutorials - 4. It's time to say goodbye.
Hi all, in last tutorial, Use Squidoo to Optimize Web 2.0 Website Tutorials - 1, we talked about how to register your account, now we will introduce something about how to set up a new lens. You must remember that we have set up a new lens in last tutorial, in fact, it has become a finished lens which can show some information to guests. However, would you like to visit a lens which only has a title without any introduction or description?
Most of the time, you will like to browse a website with beautiful UI and useful links, so we should decorate our lens with all kinds of modules. Moreover, we can add any information of our website or products into these modules without any cost in order to attract the spider of search engine. Squidoo.com has provided many kinds of modules and allowed you to add modules by yourself.
Now we will continute to edit our lens which has been set up in last tutorial.
Step 1: When you click the "create" button and you will see the page like this:
In this step, you can enter the particular topic of your lens, maybe system will give you some advice or suggestion, such as "how to roast your own coffee beans", "why you should hire me", "top 10 Wii games for kids" and so on. Of course, you are allowed to enter a special area about your website or products. Then click the continue button, and you will go to the next page.
Step 2 : Enter your goal for your page. There are four choices for you.
Choosing the first one means that you want to popularize and publized your page.
Choosing the second one means that you want to get profit from the click rate of your page.
Choosing the third one means that you want to make your page show on the frontpage of the Squidoo.com, so you should decorate your page carefully and add some new useful information into your page.
Choosing the fourth one means that you just want make this page become your own blog and record some trifle of your life.
Choose your favorite one and click the continue button, you will see this page:
Step 3 : Create a title and URL of your lens. This title will be showed on the top of your page, so you should give it an attractive title. Then you should enter the URL of your page, please be carefull, URLs of these pages have the same suffix, and they have the same format : http://www.squidoo.com/URL--username. The http://www.squidoo.com/ is the same suffix, and URL is your own URL address, you can decide it by yourself, the username is your username in this website. Please remember, you are allowed to enter the letters, numbers, underscores and dashes, besides, your can't input any special character. Otherwise you will receive this terrible warning:
Change my URL like this and remove this warning like this:
Now it's the final step and you should set up the keywords or tags of your page in order to make the search engine spider can , it's very easy and interesting.
Step 4 : It is the time to set up your keywords and tags. You are allowed to enter a best keywords and three tags for your lens. In fact, they are all tags of your lens, but the best keywords will be shown on the top of these tags. Think over and choose the best keywords to describe your page, and then choose three best tags. After entering the identify code and clicking the "Build My Lens" button, you will see your first lens!
Wow, I see many modules, but the page looks so ugly! Don't worry, we still have a lot of work to do. It seems like a newborn baby without anything except blood and amniotic fluid. When you have cleaned and dressed up him or her, you will find out that you possess the most pretty baby in all world. In a similar way, if you edit modules and do other thing, you will find out that your lens have become this page:
If you want to see this page as soon as possible, please follow me and begin to learn in the Use Squidoo to Optimize Web 2.0 Website Tutorials - 3.
Now we are in the Web 2.0 period, have you still optimized your website with lots of antique SEO tools? You have many kinds of choice to optimize your website, and you also have all kinds of ways to change your life style.
Squidoo.com is a very interesting website, you can google it or search its information from wiki. In a word, Squidoo is a useful website which can allow you to optimize and popularize your website or product. It provides a smart but useful page named lens which is seemed as a simple model, and it allows you to add some modules to your own lens. So you can add information about your website and product into these modules.
In fact, Squidoo is an excellent website which does a good job in SEO and website's architecture, so if you use the lens of Squidoo to publicize your website, the spride of search engine will get over your website time and time again.
OK, at first, we will tell you how to register your account in the Squidoo and set up your first lens.Let's go from here.
Step 1: You can click the site URL of Squidoo: http://www.squidoo.com or click here. At this time, you will see the page like this picture:
You will see many categories, and thousands of lens in different categories. You can choose your favorite one and enjoy these pretty lens.Oh, don't forget, the job of us is to establish our first len.
So, you should find out three blue buttons on the top right corner of this page: the first one is "what's Squidoo?",you will find many details of Squidoo from here. The second one is "Log in", when we have finished the register step, we will log in our own account from here. The last one is "Sign Up", we will register our account form here.
Step 2: Click the "Sign Up"button and see the page like this:
You should enter some information about you, for example, first name, last name, email and so on. Please notice, you will enter your email address and password twice in order to avoid entering the misinformation. And you should enter your nickname in the textbox of desired username.
Then you will find a check box to ask if you want to start now. I choose the first option, and then I find out the three other options have been choosed also. The last job is to enter the identifying code, then click the green "Continue" button, and you will this page:
Step 3: Enter the title of your lens and click the button "Create", now a new lens has been established! Please remember to intitle an interesting and popular name for your lens!
Welcome to this new series of tutorial of iPhone development.They are made by Venus Team. During this process,we have obtained many reference from the famous iPhone development website:
At first we will introduction the iPhone development environment--SDK, its latest edition is SDK 3.1.You can click here to download it. Notice: An apple ID is essential,and you have to register and login this website before downloading this IDE.
We needn't to talk about the resplendent legend of apple empire and Steve Jobs, but we are absorbed in the tools and technologies of iPhone development.Before beginning a project, you need a MAC with MAC OS X,maybe you would like to code in the Microsoft Windows XP or other OS, you can try this method:
1. Anyway, you need an iPhone or iPod Touch with these software:Open SSH, iPhone 2.0 Tool chain, and the BossPrefs which can run the Open SSH and SpringBoard.
2. Install the cygwin, a Linux-like environment for Windows.It consists of two parts:cygwin.dll and a collection of tools which provide Linux look and feel.You can click here to download it and obtain the user guide.Besides, you need to install these pkg: autoconf, binutils, bison, flex, gcc-code ,gcc-c++, make, openssh and openssl.
3. Install the iPhone 2.0 Toolchain and depress it, please use the cygwin instead of winrar.
4. Compile the iPhone 2.o Toolchain.
If you can do it step by step,now you will establish your first project. However,we don't recommend to use this method to simulate an iPhone development environment in Windows OS. We suggest using Mac OS if possible.
If you own a Mac and iPhone or iPod Touch, you can do it like this:
1. You need a Mac and iPhone or iPod Touch at first, then ensure the edition of Mac OS X is above 10.5.4 in order to use SDK correctly.
2. Install the Xcode, Apple's first-class IDE, which can provide all the tools you need to design your application UI and write the code.
3. You need the iPhone 2.0 Toolchain also,and you can click here to download it.
4. You should configure the environment variable like this: