We love designing and developing websites, but what really drives us is solving problems and cultivating strong relationships with our clients
Getting started with PhoneGap using Xcode for Mobile app development
By : shabda
This is next in the series of apps I am building using various mobile technologies. It is the same app as build using Java for Android for calculating the Tax payable (in India). You can get the code for Objective-C, Java-Android, and PhoneGap.
First the impressions
Phonegap was the easiest to work with among the Objective-C, Java and PhoneGap, by far. I created the app as easily as
Step 1. Write the app and test it in Browser using the Chrome developer tools. Step 2. Start a project in Xcode. Step 3. Copy the HTML and CSS files to project directory and export to simulator.
The experience was very good, (After spending time with Obj-C and Java), as I could use a Chrome console as a repl, something which I sorely missed.
The exported app does look native, with controls which look coming from browser. But with some CSS you can go a long way here.
Getting started
- Get the Xcode and the Iphone SDK.
- Download PhoneGap and install from PhoneGap iOS, this will create a new user template for PhoneGap in Xcode.
- Create a PhoneGap project in Xcode.
- Edit the www/index.html
Code like it is the web
I don't like working with the code->compile->check in simulator cycle. You can work much faster if you work with the browser.
I edited the index.html, adding the Jquery library for easy DOM manipulation, and a bit of CSS to align.
Lay out the Layout
You can layout your UI using the common HTML elements. Here is a snippet from the finished app.
<div class="input">
<label>
Your investments under 80D are:
</label>
<input type="number" placeholder=0 id="infra_investment"></input>
</div>
<div class="input">
<label>
Your housing loan interests paid are:
</label>
<input type="number" placeholder=0 id="housing_interest"></input>
</div>
These are standard HTML5 elements. Note that we were able to use HTML5 only elements like
type="number" placeholder=0
which set the keyboard type and placeholder which you can do via android:inputType or editing in Interface Builder.
Code the code
We will write the code to get the input values and then calculate the tax. We are using Jquery functions for UI manipulation. Here is what the code looks like.
$("#calculate_tax").click(function(){
income = $("#income").val();
investment = $("#investment").val();
infra_investment = $("#infra_investment").val();
housing_interest = $("#housing_interest").val();
medical_premium = $("#medical_premium").val();
console.log(""+income+investment+infra_investment+housing_interest+medical_premium);
if (!income){
income = 0;
}
.....
var tax = calculateTax(income, investment, infra_investment, housing_interest, medical_premium);
console.log(""+tax);
calculated_tax = $("#calculated_tax");
calculated_tax.html(tax);
});
function getTax(taxableIncome){
.....
Put on iPhone
Once you like what you see in chrome, you can put this code on simulator. Build and run from Xcode and you are done.
Resources
Comments
let me know if some application developed using PhoneGap, is fine for upload to appStore ? (they evaluaty the native codes). PhoneGap is a framework that use xcode?
thank you in advance
Freddy
Reactions
http://agiliq.com/blog/2011/02/getting-started-with-phonegap-using-xcode-for-mobi/ Getting started with Phonegap.
Getting started with Phonegap and Xcode - http://bit.ly/g7OU3g - [Hacker News FH]
- Deploying Django apps on Heroku
- Deploy Django App in 5 Easy Steps
- Project Management Tools for Start-Ups
- Generating a pdf from an image using PIL and django
- Dynamically attaching SITE_ID to Django Caching
- Screencast: How to deploy Django on Heroku
- Deploying Django apps on Heroku
- How to use pep8.py to write better Django code
- Screencast: Django Tutorial Part 1
- How and why to use pyflakes to write better Python
- rails
- django
- linkroundup
- django opinion
- opinion
- business
- API
- appengine
- python
- satire
- startup
- Uncategorized
- marketing
- personal
- rambling
- search
- interviews
- seo-interviews
- 5startupideas
- ideas
- seo
- tips
- forms
- paypal
- utilities
- datetime
- web2.0
- Amazon
- algorithms
- presentations
- products
- pinax
- satchmo
- ecommerce
- microsoft
- yahoo
- book
- tutorial
- models
- aggreagtion
- meta
- India
- apps
- about
- CSS
- Design
- wordpress
- test slug
- vim
- urls
- reviews
- javascript
- xmpp
- emacs
- Typography
- Grid Theory
- Color Theory
- iphone
- android
- titanium
- mobile applications
- CSS3
- Browser Compatibility
- mobile
- jobs
- lamson
- django setup
- files
- upload
- jsTree
- hierarchical view
- web page
- Treeview
- coffeescript
- request
- response
- South
- django south
- django migration
- --fake
- screencasts
- django caching
- SITE_ID prefix
- review
- code hosting
- comparison
- unfuddle
- fogbugz
- assembla
- github
- project management
- ticketing system
- gunicorn
- deploy
- nginx
- ubuntu
- vps
- April 2012
- February 2012
- January 2012
- December 2011
- October 2011
- September 2011
- July 2011
- June 2011
- April 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- June 2010
- April 2010
- March 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009
- February 2009
- November 2008
- October 2008
- June 2008
- May 2008
- April 2008
As the leading language-learning software in the world, Rosetta Stone makes learning a new language second nature. Millions of learners in more than 150 countries have already used our software to gain the confidence that comes with truly knowing a new language. We’re continually improving our software technology and adding new products. With Rosetta Stone at the helm, the future of language learning is very bright indeed.