Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


SSWUG

Reader rating:
Click here to read 3 comments about this article.
Article source: CoDe (2011 Sep/Oct)


Article Pages:  1  2 3 4 5 - Next >


Building an iOS Application to Search Twitter

This article will cover building a simple Twitter client that allows users to search for tweets, save those search terms, and recall them at any time. The sample in this article will use Xcode 4 and the iPhone SDK 4.3. All examples are in Objective-C. You can find the code for this article at http://github.com/subdigital/code-mag-twitter-searcher. I encourage you to download the code to help out if you get stuck.

This will be a whirlwind tour, so grab a snack, pull up to the nearest Mac and try it out with me.

A Primer on Objective-C

iOS applications are written in Objective-C, which is a dynamic language based on C. Objective-C takes a little getting used to; so if it is foreign to you, don’t worry. At first it can seem confusing, but eventually the syntax becomes clear. Here is a small primer to get your started:

//calling methods
[someOrder cancel];

/* This is also described as sending the “cancel” 
message to the a variable called “someOrder” */
//calling methods with input
[customer setArchived:YES];
[customer setFirstName:@"Darth" lastName:@"Vader"];

/* Notice how the name of the method also helps name 
the arguments. Read these examples over again in your
head a few times until you understand what’s going on
here. */
//declare a variable, allocate an instance
SomeObject *someVariable = [[SomeObject alloc] init];

/* Notice here how you can nest square brackets. Here
the “alloc” message is sent to the “SomeObject” class,
allocating some memory for storage. The memory is
junk, however, until it has been initialized. The
return value of “alloc” is sent the “init” message. In
Objective-C, constructors are called initializers and
always start with the word “init”. */

//declare a method
- (void)doSomething {

}

/* The “-“ signifies it as an instance method (a “+” 
would indicate static, or class, methods). The return
type is void and the method name is “doSomething” */
//declare a method with input
- (BOOL)isEven:(NSInteger)input {
  return input % == 0;
}

/* Here the return type is BOOL (a boolean) and the
method takes an integer argument called “input”.  */

For a more detailed tutorial, check out the excellent site, CocoaDevCentral:

http://cocoadevcentral.com/d/learn_objectivec/.

So now that you’re an expert in Objective-C syntax, let’s delve into building an iPhone application. First, we need an IDE.

Getting Xcode 4

Xcode 4 is freely available for Apple Developer Members. If you’re not a member, you can pay $4.99 at the Mac App Store to download Xcode 4. Using Xcode you can build and run applications utilizing the built-in iPhone Simulator. However if you plan to deploy your iPhone apps to a real device you’ll need to cough up $99/year to the Apple iOS Developer Program, located at http://developer.apple.com/ios. Being a member has its benefits though, such as allowing you to run your applications on a device, distribute your applications in the App Store, browsing the forums for help & advice, and getting access to pre-release versions of Xcode and the iOS SDK.

If you have Xcode 3 (version 3.2.6 to be precise) then you can most likely follow along, however, Xcode 4 has changed things significantly.

When you’re ready, launch Xcode 4.

Creating a New iPhone Project in Xcode 4

When you first launch Xcode 4, you’re presented with a launch screen inviting you to create an application. Let’s do that now.

You’ll want to select Create a new Xcode project. There are a few project templates to help you get started. For this article, choose the Navigation-based Application, as shown in Figure 2.

Click for a larger version of this image.

Figure 1: Xcode 4 Welcome screen.

Click for a larger version of this image.

Figure 2: Starting off with the Navigation-based Application template.

Choosing the navigation-based template will generate a bare-bones application that is useful for display lists of data. It includes a UINavigationController (useful for traversing lists of data and progressing through various screens) as well as a view controller that derives from UITableViewController. The UITableViewController is perfect for our needs because we’d like to display the Twitter search results in a list.

Go ahead and select Next and give the application a name. You’ll also need to pick a bundle identifier. Typically this is in the format of com.companyname.appname. Don’t worry too much about choosing the correct value here. You can always change it later.

Xcode 4 will generate a basic project that is ready to run. Figure 4 shows the starter project.

Click for a larger version of this image.

Figure 3: Giving the application a name and bundle identifier.

Click for a larger version of this image.

Figure 4: The initial project created by Xcode.

&

By: Ben Scheirman

Ben Scheirman is a software developer, speaker, author, and blogger. He has extensive experience programming on a multitude of platforms, such as .NET, Ruby on Rails, and iOS. He’s written two books, a couple dozen iPhone apps, and worked on countless web applications. He is the Director of Development for ChaiONE where he builds awesome Ruby and iPhone applications. You can catch him on Twitter at http://twitter.com/subdigital and on his blog online at http://flux88.com.

subdigital@gmail.com



Article Pages:  1  2 3 4 5 - Next Page: 'Adding 3rd-Party Libraries' >>

Page 1: Building an iOS Application to Search Twitter
Page 2: Adding 3rd-Party Libraries
Page 3: Back to the User Interface
Page 4: Creating a Custom Tweet Cell Class
Page 5: Fetching Avatars Seamlessly

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3.2 out of 5

5 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      LearnNow

 

SSWUG