mobile real estate agent for iphone
TRANSCRIPT
MOBILE REAL ESTATE AGENT FOR IPHONE
______________
A Thesis
Presented to the
Faculty of
San Diego State University
______________
In Partial Fulfillment
of the Requirements for the Degree
Master of Science
in
Computer Science
______________
by
Rakhi Harkawat
Fall 2011
iii
Copyright © 2011
by
Rakhi Harkawat
All Rights Reserved
iv
ABSTRACT OF THE THESIS
Mobile Real Estate Agent for iPhone by
Rakhi Harkawat Master of Science in Computer Science
San Diego State University, 2011
With the rise in standards of living and prosperity, and continuous growth in technology, throughout the world, people’s desires are also rising. They want more for themselves. They want a good life style, a good home. Now, when one plans to buy a property, one of the biggest challenges he/she faces is locating a property. Before the Internet, people used to first contact real estate agents, who had a limited list of properties in their database or you could drive around a neighborhood.
For people wanting to locate properties themselves, the Internet offers a good alternative. A lot of websites now cater to this need. People can go to these websites and get results. But this is the era of devices like smartphones, etc. The last couple of years have seen a huge increase in the sale of smartphone devices. iPhone devices constitute the third largest population of all the smartphones and in the USA they are ranked second in smartphone sales. Nobody wants to just look for a property while sitting at home. People also want to go out and look for a property and if they do not find it good, then search for another one, after lunch maybe. A smartphone is useful during lunch.
With the advancement of the latest wireless technology and devices, mobile professionals and companies came up with smartphones to provide the solution to such problems. They are capable of giving the user the ability to connect to the Internet. But, thinking from a user’s point of view, it is not a good experience going to a mobile browser and hunt a property over there. Mobile browsers have limitations of their own. It’s not the same experience when you browse a website over a smartphone. On a smartphone, the small screen hampers the browser use. An iPhone application thus makes it easier to directly feed in your requirements and get the list of properties, respective contact personnel, etc. This will be of a kind of integrated solution for all user concerns when it comes to finding a suitable property, while mobile.
v
TABLE OF CONTENTS
PAGE
ABSTRACT ............................................................................................................................. iv
LIST OF FIGURES ................................................................................................................ vii
LIST OF ABBREVIATIONS ................................................................................................ viii
ACKNOWLEDGEMENTS ..................................................................................................... ix
CHAPTER
1 INTRODUCTION ........................................................................................................ 1 1.1 Real Estate Agent Application: A Blueprint ..................................................... 1 1.2 Need for Real Estate Agent on iPhone Platforms ............................................. 2
2 TECHNOLOGY ........................................................................................................... 4 2.1 iPhone Application Development ..................................................................... 4 2.2 Key Objects in an iOS Application ................................................................... 5 2.3 iPhone Application Life Cycle .......................................................................... 6 2.4 Launching the Application ................................................................................ 7 2.5 Exiting the Application ..................................................................................... 8 2.6. iPhone Application SDK .................................................................................. 8
3 IMPLEMENTATION ................................................................................................. 10 3.1 Setting Up the Development Environment ..................................................... 10 3.2 Implementation of the Tab Bar ....................................................................... 10 3.3 Implementation of the MLS Search ................................................................ 11 3.4 Implementation of the Quick Search .............................................................. 17 3.5 Implementation of Detailed Search ................................................................ 22 3.6 Implementation of Agent List ......................................................................... 25 3.7 Implementation of More Menu ....................................................................... 29
3.7.1 Show Map .............................................................................................. 29 3.7.2 Directions ............................................................................................... 32 3.7.3 To Show ................................................................................................. 32 3.7.4 Agent Info .............................................................................................. 32
vi
3.7.5 Public Remarks ...................................................................................... 33 3.7.6 Realtor Remarks ..................................................................................... 33
3.8 Implementation of Mortgage Calculator ......................................................... 33 4 FINAL RESULTS ...................................................................................................... 37
4.1 MLS Search Demo .......................................................................................... 37 4.2 More Menu Demo ........................................................................................... 38 4.3 Quick Search Demo ........................................................................................ 39 4.4 Detail Search Demo ........................................................................................ 40 4.5 Agent List Demo ............................................................................................. 41 4.6 Mortgage Calculator Demo ............................................................................. 42
5 COMPARATIVE STUDY WITH ANDROID .......................................................... 49 5.1 Development Environments ............................................................................ 49 5.2 Programming Ease .......................................................................................... 49 5.3 Handling Application Stores ........................................................................... 49 5.4 Documentation ................................................................................................ 50 5.5 Tools ............................................................................................................... 50 5.6 User Experience .............................................................................................. 50 5.7 Expandable Memory ....................................................................................... 50 5.8 Process Juggling .............................................................................................. 50 5.9 Openness ......................................................................................................... 51
6 CURRENT LIMITATIONS ....................................................................................... 52 7 FUTURE IMPROVEMENTS .................................................................................... 54 8 SUMMARY ................................................................................................................ 56 9 CONCLUSION AND OBSTACLES ......................................................................... 58
BIBLIOGRAPHY ................................................................................................................... 59
vii
LIST OF FIGURES
PAGE
Figure 1.1. Share of worldwide 2011 Q2 smartphone sales by OS, according to Gartner. ......................................................................................................................... 2
Figure 2.1. iOS technology layers. ............................................................................................ 4 Figure 2.2. Key objects in an iOS application .......................................................................... 6 Figure 2.3. iPhone application life cycle. ................................................................................. 7 Figure 2.4. Launching into the active state ............................................................................... 8 Figure 2.5. Moving application from foreground to background ............................................. 9 Figure 3.1. X-code IDE. .......................................................................................................... 11 Figure 3.2. TabBarController. ................................................................................................. 12 Figure 3.3. MLS search. .......................................................................................................... 14 Figure 3.4. Quick search. ........................................................................................................ 18 Figure 3.5. Detail search. ........................................................................................................ 23 Figure 3.6. Agent list. ............................................................................................................. 26 Figure 3.7. More menu. ........................................................................................................... 30 Figure 4.1. Demo of MLS search view and property details view. ........................................ 37 Figure 4.2. Demo of more menu and show map view. ........................................................... 38 Figure 4.3. Demo of directions and to show view. ................................................................. 39 Figure 4.4. Demo of agent info and public remarks view. ..................................................... 40 Figure 4.5. Demo of realtor remarks view. ............................................................................. 41 Figure 4.6. Demo of quick search view and property list view. ............................................. 42 Figure 4.7. Demo of property detail view and no property alert. ........................................... 43 Figure 4.8. Demo of detail search view and no property alert. ............................................... 44 Figure 4.9. Demo of agent search view and agent list view. .................................................. 45 Figure 4.10. Demo of agent details view and no agent alert. .................................................. 46 Figure 4.11. Demo of mortgage calculator view and its result breakdown view. .................. 47 Figure 4.12. Demo of missing fields alert. .............................................................................. 48
viii
LIST OF ABBREVIATIONS
IDE Integrated Development Environment
MLS Multiple Listing Service
NAR National Association of Realtors
Nib NeXT Interface Builder
OpenGL-ES Open Graphics Library – Embedded Systems
OS Operating System
P&I Principal and Interest
POSIX Potable Operating System Interface for UNIX
SDK Software Development Kit
SDLC Software Development Life Cycle
UI User Interface
UNIX Uniplexed Information and Computing System
URL Uniform Resource Locator
ix
ACKNOWLEDGEMENTS
I would like to accredit the success of this thesis to the support and guidance, which
has been provided to me by thesis advisors, Dr. Carl Eckberg, Dr. Joseph Lewis and
Dr. Ming Tsou. With the continuous encouragement provided by Dr. Carl Eckberg, my
confidence was always up. I discussed the progress of the thesis. I worked with him over
various strategies required for working over this Real Estate Agent Application for iPhone.
I am grateful to Dr. Joseph Lewis who provided invaluable suggestions and support in
this thesis work. I discussed some of the UI design for this application with him. Dr. Carl
Eckberg and Dr. Joseph Lewis, also provided a lot of support in my academic program as
well.
I am also thankful to Dr. Ming Tsou, was also a great resource for this thesis work.
He provided me with some very important documents and material related to iPhone
application development. All three of my thesis advisors have been a great source of
inspiration and support during this thesis work. Thus, I would like to pay my regards and
thank all three of them.
1
CHAPTER 1
INTRODUCTION
1.1 REAL ESTATE AGENT APPLICATION: A BLUEPRINT Mobile applications aim is to help users solve at least one real life problem, or
entertain them. Now, an application can either be a game, a chat client, weather forecast,
news, live streaming, video or audio application, the sole idea behind them is that they serve
a purpose. Similarly, the “Real Estate Agent Application for iPhone” aims to satisfy the
needs of people who are searching for a property. Be it a rental property or a property for
sale, the users just need to run the application, enter the various search parameters and then
let this application to look for properties for them.
Using this application, a user will be able to search for a property, using one of the
three search options available, i.e. MLS Number Search, Quick Search and Detailed Search.
Users can also access and search in the Agent Directory and see the location of the property
on a map. Apart from this, using the Mortgage Calculator, the user can calculate the
mortgage for any property. A Multiple Listing Services (MLS) Number is a unique number
assigned to each property, by local real estate professionals, who belong to the National
Association of Realtors (NAR) [1].
This application development underwent various planning and implementation
phases. It started from designing the blueprint of the UI and ended up with some final testing
of the application. The major outline of this whole process is presented here:
1. Gathering some requirements, studying some existing applications and websites [2]. 2. Making blueprint of the User Interface for the application.
3. Implementing the various types of searches using XML Parsing. 4. Implementing the show maps feature to show the location of the property.
5. Bringing the Mortgage Calculator into action. 6. Implementing the Direct Calling feature on the Real Estate Agent View.
Apart from all these things, a lot of iPhone issues have been dealt with. Everything
related to all this has been described in the respective chapters.
2
1.2 NEED FOR REAL ESTATE AGENT ON IPHONE PLATFORMS
There has been tremendous growth in the smartphone sector. Before mid 2007, when
iPhone was released, the Symbian operating system was the pioneer in the smartphone
market. After this, a huge growth is noticed in development of mobile applications. Apple’s
iPhone now constitutes 18% of the total smartphone sales in the world and ranks third. It
ranks second to Android. In Figure 1.1 [3] you can see a pictorial representation of the
smartphone sales report from Gartner.
Figure 1.1. Share of worldwide 2011 Q2 smartphone sales by OS, according to Gartner. Source: Wikipedia. Mobile Operating System, 2011. http://en.wikipedia.org/wiki/Mobile_operating_system, accessed Oct. 2011.
Given that a large number of people are using iPhones, it makes sense to have an
application available for them to search for properties, while they are out of their homes on
the search for a good property matching their needs, dreams and pockets. I came in contact
with a group of people from a Kentucky based company AGILITY CORP, via an
intermediate person. They also wanted to work on a similar application and have solutions
3
already available for Blackberry OS, Palm OS, etc. After, this I started working on the
iPhone solution. The most challenging work was interacting with the customers because of
difference in time zone. Mostly, the interactions were made using emails and few times
Skype calls were also preferred. After considerable testing and evaluation, the client is
expected to use this as version soon.
Now, the first task was gathering requirements, analyzing and studying some of the
existing applications and websites. The two most noteworthy, of those which I studied, were
Trulia (mobile app) [4] and www.zillow.com [5], a website for real estate search and
information. Both of these were very good, but they lacked a common feature. Neither had
the ability to search a property based on various parameters like bed, bath, size, list price,
type of property, etc. These applications searched a property based on its location. So, in this
iPhone application, three different kinds of searches were finalized to be included. These
three types of searches are:
1. MLS Search – Searches a property using its MLS Number.
2. Quick Search – Searches a property based on its address or location. 3. Detailed Search – Searches a property based on various parameters like number of
bedrooms, bathrooms, size, etc. 4. Apart from this the other features that have been planned for this application include:
5. Agent Search – Searches a Real Estate Agent based on his/her first name, last name or listing office.
6. Mortgage Calculator – Calculates the loan amount required and gives the user a rough estimation of the monthly P&I.
7. Show Map – Shows the location of the property on Google Maps. 8. Public and Realtor Remarks on the property.
9. To Show – Gives information about the steps to take to see the property, schedule an appointment, etc.
4
CHAPTER 2
TECHNOLOGY
2.1 IPHONE APPLICATION DEVELOPMENT Apple’s Mobile Operating System is known as iOS or iPhone OS. It supports multiple
smart devices from Apple, i.e. iPhone, iPod Touch, iTouch. iOS is derived from Mac OS X.
It is Unix-like OS by nature. This is so because the kernel in iOS is the same as Mach kernel
of the Mac OS X.
The four technology layers or abstraction layers, which reside on top of the iOS
kernel are shown in Figure 2.1 [6].
Figure 2.1. iOS technology layers. Source: Apple. iOS Overview, 2010. http://developer.apple.com/ library/ios/#referencelibrary/GettingStarted/URL_iPhone_OS_Overview/_index.html%23//apple_ref/doc/uid/TP40007592, accessed Oct. 2011.
The two base layers i.e. the Core OS and the Core Services contain the C-based
interfaces for iOS, which involve technologies like Core Foundation, CFNetwork, SQLite,
etc. They also cover how to access the POSIX threads and UNIX sockets. Some examples of
interfaces can be interfaces for accessing files, low-level data types, etc.
5
A blend of C and Objective-C [7] can be found in the upper layers. The media layer
includes OpenGL Embedded Systems (ES), Quartz and Core Audio. These all are C-based
technologies. The media Layer also has the ability to support 2D and 3D drawing, audios and
videos.
Objective-C is used by technologies in the Cocoa Touch Layer. The basic
infrastructure which is required by an application is provided by the frameworks at these
layers. An object oriented approach or support is provided for collections, network functions,
file management, etc. Another framework, i.e. UIKit helps in providing the visual
infrastructure to any application. It helps in creating windows, views, controls, controllers to
manage objects, etc. This layer forms the starting point of any application.
Its normally a good approach to start from higher level platforms while developing an
application. This is so because, in this way, a lot of the important and necessary infrastructure
will be ready in the initial phases of the application development.
2.2 KEY OBJECTS IN AN IOS APPLICATION The following are the key objects and their roles in an iOS application (and illustrated
in Figure 2.2 [8]):
1. UIApplication object: It manages the event handling in the application. It can be used to configure the appearance of the application.
2. Application delegate object: It resides in the nib file (extension is .xib) of the application. It initializes the application. It notifies the different objects when any other application level event is supposed to happen. For example, if an application needs to be interrupted, etc.
3. Data model objects: The content of the application is stored in these objects. For example, depending on the type of application, it might store a database, an image object or something else.
4. View controller objects: The presentation of the content of the application is managed by these objects. They create views, manage interactions between views and data model objects of the application.
5. UIWindow Object: This object helps in presenting different views on the device screen. The content in an application is changed by changing the views.
6. View, control and layer objects: A View helps in drawing the content in a rectangular area and then it responds to the event within that specified area.
A Control is a specialized view which implements the various UI objects like buttons,
text fields and toggle switches.
6
Figure 2.2. Key objects in an iOS application. Source: Apple. iOS App Programming Guide, 2011. http://developer.apple.com/library/ios/ documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf, accessed Oct. 2011.
Layer objects represent visual content. These objects are used by views to render their
content. Custom layer objects can be added to the interface for implementation of complex
animations and to add visual effects.
2.3 IPHONE APPLICATION LIFE CYCLE In the life cycle of an iPhone application, when the user taps the application icon the
main method is called, which further calls the UIApplicationMain() method (see Figure 2.3
[8]). From there, a series of events are called and executed, until the application is asked to
quit. Once the application quits, the application moves to the background. Now, this was
from perspective of UIKit. Lets take our code into consideration as well. So, at the point
7
Figure 2.3. iPhone application life cycle. Source: Apple. iOS App Programming Guide, 2011. http://developer.apple.com/library/ios/ documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf, accessed Oct. 2011.
where the UIApplicationMenu() is called, from our code method, it will be checked whether
the application did finish launching with options. Also, during the event loop, events are
handled by our code. Now, when the application is asked to exit, from our code
applicationWillResignActive: method will be assigned to the application and when the
application moves to background, the method which is called is
applicationDidEnterBackground:.
2.4 LAUNCHING THE APPLICATION When the application is launched, the main nib is loaded and creates the application
delegate. On the next step the application is initialized and didFinishLaunchingWithOptions:
method is called. Then after this the application enters the foreground and calls the method
applicationDidBecomeActive:. See Figure 2.4 [8].
8
Figure 2.4. Launching into the active state. Source: Apple. iOS App Programming Guide, 2011. http://developer.apple.com/library/ios/ documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf, accessed Oct. 2011.
2.5 EXITING THE APPLICATION When the user presses the home button, while the application is running, the
applicationWillResignActive: method is called and the application moves to the background
and calls the applicationDidEnterBackground: method. See Figure 2.5 [8].
2.6. IPHONE APPLICATION SDK The iPhone Software Development Kit (SDK) [9] allows developers to make
applications for the iPhone and the iPod Touch. Xcode is the development environment for
the iOS SDK. The applications for iPhone and iPod Touch are written in Objective-C. An
emulator with this makes this package complete. This can be used to test the iPhone
applications.
In the next chapter, you can find the details on the implementation of the various
functionalities of the application. Chapter 4 shows the final result or the final output of the
application, various screen shots in there will help you understand the flow and working of
the application. Chapter 5 provides a comparative study with Android OS. Chapter 6 deals
9
Figure 2.5. Moving application from foreground to background. Source: Apple. iOS App Programming Guide, 2011. http://developer.apple.com/library/ios/ documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf, accessed Oct. 2011.
with the limitations of the application and Chapter 7 talks about removing these limitations in
the Future Work. Chapter 9 gives the summary of the whole application. Conclusion on this
application is provided in Chapter 9.
10
CHAPTER 3
IMPLEMENTATION
3.1 SETTING UP THE DEVELOPMENT ENVIRONMENT The first thing that was required to develop an iPhone application was to get the
development environment setup [10]. The development was required to be done on Mac OS.
Now, first thing needed to do the development was Xcode IDE (see Figure 3.1). I got the
latest version of the Xcode IDE from Apple website. It comes embedded with an iPhone
simulator to run and test our custom applications. But, to actually deploy your application on
an iPhone, one needs to buy an iPhone developer license for $99 an year. Once we have all
this, we are all set up for writing code for an iPhone application, using Objective C. Now, C
and C++ can also be used for developing iPhone applications but Objective C is the most
preferred option and I stuck to it. The two important frameworks I used were
UIKit.framework and MapKit.framework, the later one was used for the Show maps feature
of this application.
3.2 IMPLEMENTATION OF THE TAB BAR I started with the implementation of the Tab bar, which is the base controller for the
whole application. I configured this tab bar to have five different tab bar menu items viz. a
viz. MLS Seach, Quick Search, Detail Search, Agent List and Mortgage Calculator. Selection
of each of these options actually calls the respective navigation controller and the table view
controller which is associated with it. For example, when the user selects the MLS Search tab
bar item, it calls the MLSNumberNavController along with
MLSNumSearchTableViewContoller. This actually then renders the MLS Search view on
the device UI. As soon as the application is launched, the didFinishLaunchingWithOptionss
method from AgileAgentAppDelegate is called. It actually loads the tabBarController to the
main window and makes it visible (see Figure 3.2).
11
Figure 3.1. X-code IDE.
//AgileAgentAppDelegate.m didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self parsePlist]; [self parseLoginXML]; [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; return YES; }
3.3 IMPLEMENTATION OF THE MLS SEARCH When the user selects the MLS Search, it will take the control to the
MLSNumberSearchTableViewController. Now, the viewDidLoad method is called at first,
12
Figure 3.2. TabBarController.
which sets the MLS Search icon as the rightNavigationBarItem and it is action is thus set to
call the doMLSSearch method.
- (void)viewDidLoad{ self.title = @"MLS Search"; self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch
13
target:self action:@selector(doMLSSearch:)] autorelease]; [self setMlsNumberCell: [self newDetailCellWithTag:0]]; }
After this, the UITableViewDelegate methods are called, which actually design the
table and cells. The list of such methods is as follows:
1. numberOfSectionsInTableView: 2. numberOfRowsInSection:
3. cellForRowAtIndexPath: 4. titleForHeaderInSection:
5. didSelectRowAtIndexPath: Out of all these methods, cellForRowAtIndexPath is used to create the cells. Now, the
mlsNumberCell is being created here and required UITextField(s) are set up. To bring up the
required numeric keyboard to get the data from the user, the keyboard type has been set to
UIKEyboardTypeNumbersAndPunctuation.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { EditableTableCell *cell = nil; NSInteger tag = INT_MIN; NSString *placeholder = nil; NSUInteger section = [indexPath section]; cell = [self mlsNumberCell]; tag = 0; placeholder = @"MLS Number"; UITextField *textField = [cell textField]; [textField setTag:tag]; [textField setText:@""]; [textField setPlaceholder:placeholder]; if (section == 0){ [textField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation]; [textField setReturnKeyType:UIReturnKeyDone]; } return cell; }
Now, the doMLSSearch method actually does the search which is requested by the
user. After the user inputs the MLS Number of the property, it is picked up by this method
(see Figure 3.3). This input value is thus appended on the MLSSearchURL as
14
Figure 3.3. MLS search.
“&MlsNumber=******”. This MLSSearchURL is actually stored in
AgileAgentAppDelegate. The complete URL with the MLS Number, then requests the server
to get the required data. The server responds back with the XML output, which is stored in
the returnXMLString. Now this string is passed to the parser which is actually residing in
XMLParserPropertyDetails. This then returns output in the form of a key value pair, i.e.
labelList and valuesList. After this, the data is sent to the propertyDetailViewController.
15
- (void) doMLSSearch:(id)sender { AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableString *MLSSearchURL = [[NSMutableString alloc] initWithString:appDelegate.detailSearchURL]; [MLSSearchURL appendString:@"&MlsNumber="]; if ([self.mlsNumber length]!=0 ) { [MLSSearchURL appendString:self.mlsNumber]; } NSError* error = nil; NSString *returnedXMLString = [NSString stringWithContentsOfURL:[NSURL URLWithString:MLSSearchURL] encoding:NSASCIIStringEncoding error: &error]; XMLParserPropertyDetails *parser = [[XMLParserPropertyDetails alloc] init]; [parser parseXMLFile:returnedXMLString]; self.labelList = parser.labelList; self.valuesList = parser.valuesList; If(propertyDetailViewController == nil) { PropertyDetailViewController *viewController = [[PropertyDetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; self.propertyDetailViewController = viewController; [viewController release]; } self.propertyDetailViewController.labelList = self.labelList; self.propertyDetailViewController.valuesList = self.valuesList; self.propertyDetailViewController.labelValues = parser.labelValues; self.propertyDetailViewController.title = @"Property Details"; [self.navigationController pushViewController:propertyDetailViewController animated:YES]; }
The URL which actually requests the server for the data is as follows:
http://www.********.com:8080/*********/TextCommandServlet?method=detailedSearch
&serialNumber=SERVER%20UNKNOWN&StoredUsername=*******
Now, lets discuss a little bit about the XML Parsing done over here. The delegate
which is used here is NSXMLParserDelegate. It defines the optional methods implemented
by the delegates of NSXMLParser objects. So, when the XML data is actually required to be
parsed, it calls parseXMLFile method.
- (void)parseXMLFile:(NSString *)data { BOOL success;
16
LabelValues = [NSMutableDictionary dictionary]; valuesList = [[NSMutableArray alloc] init]; currentString = [NSMutableString string]; storingCharacters = NO; NSXMLParser *parser = [[NSXMLParser alloc] initWithData:[data dataUsingEncoding: NSUTF8StringEncoding]]; [parser setDelegate:self]; [parser setShouldResolveExternalEntities:YES]; success = [parser parse]; currentString = nil; [parser release]; }
The different methods of the NSXMLParserDelegate which actually get called
automatically are the following:
1. didStartElement
2. foundCharacters 3. didEndElement
4. parseErrorOccured So, when an XML tag starts which is to be parsed, the didStartElement method is
automatically called and while its parsing each character one by one, its actually the
foundCharacters method, which is actually doing the work. After this, the whole strings
formed using these characters are stored in our model in the next method which is
didEndElement.
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if ([elementName isEqualToString:kLabels]) { self.labels=[[NSString alloc] initWithString: self.currentString]; self.labelList = [labels componentsSeparatedByString:@"|"]; [self.labels release]; self.labels =nil; } else if ([elementName isEqualToString:kKeys]) { self.keys=[[NSString alloc] initWithString: self.currentString]; self.keysList = [keys componentsSeparatedByString:@"|"]; [self.keys release]; self.keys=nil; for (int i=0;i<[keysList count];i++) [self.valuesList addObject:[labelValues objectForKey:[keysList objectAtIndex:i]]];
17
} else{ self.tempString=[[NSString alloc] initWithString: self.currentString]; [labelValues setObject: tempString forKey:elementName]; [self.tempString release]; self.tempString = nil; } storingCharacters = NO; }
Now, the results from this method are passed to PropertyDetailViewController. Now,
the returned values from the XMLParserPropertyDetails are displayed accordingly on the
device UI using the cellForRowAtIndexPath method. Actually the label is displaying the title
from the labelList and the values for that are coming from the valuesList in the
cellForRowAtIndexPath.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } NSUInteger sectionpath = [indexPath section]; cell.textLabel.text = [valuesList objectAtIndex:sectionpath]; return cell; }
3.4 IMPLEMENTATION OF THE QUICK SEARCH Now, when the user wants to search for properties using the different parameters, he
will use the Quick Search feature of this application (see Figure 3.4). These parameters are as
follows:
1. Street Number: The street number of the property can be used here to search.
2. Street Name: Properties can also be shortlisted based on the street name: 3. Status: A property can either be active, pending, expired or sold. So, depending on the
user’s selection, properties of that particular status can be searched. 4. Area: Area basically refers to the location of the property.
18
Figure 3.4. Quick search.
The last two options, i.e. Status and Area are available to the user via
SelectViewController.
When the users selects the option of doing a Quick Search, then the viewDidLoad
method is called from QuickSearchTableViewController.
- (void)viewDidLoad{ AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; self.title = @"Quick Search";
19
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(doQuickSearch:)] autorelease]; [self setStreetNoCell: [self newDetailCellWithTag:StreetNo]]; [self setStreetNameCell: [self newDetailCellWithTag:StreetName]]; self.areaList = appDelegate.areaList; self.statusList = appDelegate.statusList; }
Here from the app delegate, we read the statusList and AreaList. Now, as explained
earlier in the MLS Search the cellForRowAtIndexPath creates the UITableView and
configures the table cells for different search options. After this, when the user clicks on any
row for selecting status or area, then the DidSelectRowAtIndexPath method is triggered. It
opens the SelectViewController with the current view selected and other options available. In
this view controller, the selection is made using the method called
didSelectRowAtIndexPath.
After all this, the doQuickSearch method is invoked and it reads the quickSearchURL
from the AgileAgentAppDelegate. In this method only, we read the value for status, area,
street number and street name which is filled by the user. Now, this URL requests the server
for the data, for which the server responds back with some XML data. This XML data thus
needs to be parsed. The quick search URL looks like this:
http://www.**********.com:8080/********/TextCommandServlet?method=quicksearch&serialNumber=SERVER%20UNKNOWN&StoredUsername=*******&streetNumber=****&streetName=*****&area=******&status=******* - (void) doQuickSearch:(id)sender { AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableString *quickSearchURL = [[NSMutableString alloc] initWithString:appDelegate.quickSerachURL]; area = [areaList objectAtIndex:areaSelectedIndex]; status = [statusList objectAtIndex:statusSelectedIndex]; if (streetNo != nil && [streetNo length] > 0){
[quickSearchURL appendString:@"&streetNumber="]; [quickSearchURL appendString:streetNo];
} if (streetName != nil && [streetName length] > 0) {
[quickSearchURL appendString:@"&streetName="]; [quickSearchURL appendString:self.streetName];
}
20
if (area != nil && [area length] > 0 && [area rangeOfString:@"All"].location == NSNotFound ){
[quickSearchURL appendString:@"&area="]; [quickSearchURL appendString:area];
} if (status != nil && [status length] > 0 && [status rangeOfString:@"All"].location == NSNotFound ) {
[quickSearchURL appendString: @"&status=" ]; [quickSearchURL appendString: status];
} NSData * dataXml = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:quickSearchURL]]; XMLParserPropertyList *reader = [[[XMLParserPropertyList alloc] init] autorelease]; [reader parseXMLFile:dataXml]; self.propertyList = [[NSArray alloc] initWithArray:[[reader propertyList] retain]]; [dataXml release]; If([self.propertyList count] > 0){ PropertyListViewController *viewController = [PropertyListViewController alloc]; self.propertyListViewController = viewController; [viewController release]; [self.navigationController pushViewController:propertyListViewController animated:YES]; self.propertyListViewController.propertyList = nil; self.propertyListViewController.propertyList = self.propertyList; self.propertyListViewController.title = @"Property List"; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"No Property Found" message:@"Search tips to try:\n-Check search criteria\n-Try alternate spellings\n-Type partial entries" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [alertView show]; [alertView release]; } }
Now, in this method, the parseXMLFile method of the XMLParserPropertyList is
called. The methods in there like didStartElement, didEndElement and foundCharacters
actually parse the XML data. Ultimately, we get a list of the properties from here and then
this list is passed to the PropertyListViewController. In the PropertyListViewController, the
21
first method to be called is cellForRowAtIndexPath. This method actually displays a list of
properties with their MLS Number, area, price and size in each cell.
The next task to do was to display the details of the property, which is selected by the
user. This task has been accomplished by didSelectRowAtIndexPath method in
PropertyListViewController.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { int idx= [indexPath row]; Property *prop = (Property *)[propertyList objectAtIndex:idx]; NSString *mlsNum = prop.mlsNumber; AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableString *propertyDetailURL = [[NSMutableString alloc] initWithString:appDelegate.detailSearchURL]; [propertyDetailURL appendString:@"&MlsNumber="]; [propertyDetailURL appendString:mlsNum]; NSError* error = nil; NSString *returnedXMLString = [NSString stringWithContentsOfURL:[NSURL URLWithString:propertyDetailURL] encoding:NSASCIIStringEncoding error: &error]; XMLParserPropertyDetails *parser = [[XMLParserPropertyDetails alloc] init]; [parser parseXMLFile:returnedXMLString]; self.labelList = parser.labelList; self.valuesList = parser.valuesList; if(propertyDetailViewController == nil) { PropertyDetailViewController *viewController = [[PropertyDetailViewController alloc] initWithStyle:UITableViewStyleGrouped]; self.propertyDetailViewController = viewController; [viewController release]; } self.propertyDetailViewController.labelList = self.labelList; self.propertyDetailViewController.valuesList = self.valuesList; self.propertyDetailViewController.labelValues = parser.labelValues; self.propertyDetailViewController.title = @"Property Details"; [self.navigationController pushViewController:propertyDetailViewController animated:YES]; }
This method eventually calls XMLParserPropertyDetails for the specific property,
which is selected by the user, which actually parses the property details and makes it ready
for the display. The control and this data, which is actually the labelList and valueList, is thus
22
passed on the PropertyDetailViewController. This ultimately displays the details of the
property on the device UI. The description and implementation of
PropertyDetailViewController has already been described during the implementation of the
MLS Search.
3.5 IMPLEMENTATION OF DETAILED SEARCH The third type of search option which the user has is the Detailed Search (see
Figure 3.5). In this kind of search, the user can narrow down the list of properties using a
variety of search parameters. This search can also be explained as an extension of Quick
Search. Here is a list of various parameters on which this search can be done.
1. Type: It refers to the types of property like Land, Multifamily and Simple Family Residential.
2. Status: The status of the property can be something like Active, Expired, Pending or Sold.
3. Listing Date: Properties can also be searched based on the listing date. 4. Min Price: A search can be narrowed down using the minimum list price of the
property. The options here range from no min to 2,50,000. 5. Maximum List Price: A maximum cap can be set by the user on the list price of the
property, so search only those properties which suit his income and savings. 6. Bedrooms: A property can also be searched by the number of bedrooms.
7. Full Bath: Number of full baths can also be one of the search criteria’s. 8. Min Sq. Feet: The size of the property is one of the very important search criteria’s
for the user. 9. Area
10. Street Name: A property can be searched on any specific street as well. 11. City: This will help in finding properties in a city.
12. County: This will help in finding the properties in a specific county. 13. Zip Code: If the user wants to search properties in his nearby areas, he can use his zip
code to search the properties. This will give the user a very specialized set of data or list of properties which closely
matches the users need. When the user selects the Detailed search option from the menu
items, the viewDidLoad method is called. In this method, we read the statusList, areaList.
typeList. listDateList, minListPriceList, maxListPriceList, fullBathList, bedroomList,
sqFeetList from the AgileAgentAppDelegate. As explained earlier cellForRowAtIndexPath
23
Figure 3.5. Detail search.
creates the UITableVIew and table cells. When the user clicks on any row to select status,
type, bedroom, bathroom, list price, etc., then the DidSelectRowAtIndexPath method is
called. It actually thus opens the SelectViewController for the current option selected and
shows the various available options in there. In this view when the selection is to be made,
didSelectRowAtIndexPath is called.
- (void)viewDidLoad{ AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; self.title = @"Detail Search"; self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(doDetailSearch:)] autorelease];
24
[self setStreetNameCell: [self newDetailCellWithTag:StreetName]]; [self setCityCell: [self newDetailCellWithTag:City]]; [self setCountyCell: [self newDetailCellWithTag:County]]; [self setZipcodeCell: [self newDetailCellWithTag:Zip]]; self.areaList = appDelegate.areaList; self.statusList = appDelegate.statusList; self.typeList = appDelegate.typeList; self.listDateList = appDelegate.dateList; self.minListPriceList =appDelegate.minPriceList; self.maxListPriceList = appDelegate.maxPriceList; self.bedroomList = appDelegate.bedroomsList; self.fullBathList =appDelegate.bathsList; self.sqFeetList =appDelegate.sqFtList; }
After this, the doDetailSearch method comes into action and after it reads the
detailSearchURL, it appends various other search parameters onto it. Now, this URL again
requests the server for some data and the server responds back with the XML data which
again needs to be parsed using the parseXMLFile method of the XMLParserPropertyList.
The result from here is ultimately passed on to the PropertyListViewController which
displays a list of properties matching the search criteria. After this, when the user selects one
property out of that list, then the details about that property are shown by the
didSelectRowAtIndexPath method.
- (void) doDetailSearch:(id)sender { AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableString *detailSearchURL = [[NSMutableString alloc] initWithString:appDelegate.detailSearchURL]; area = [areaList objectAtIndex:areaSelectedIndex]; status = [statusList objectAtIndex:statusSelectedIndex]; type = [typeList objectAtIndex:typeSelectedIndex]; listDate = [listDateList objectAtIndex:listDateSelectedIndex]; minListPrice = [minListPriceList objectAtIndex:minListPriceSelectedIndex]; maxListPrice = [maxListPriceList objectAtIndex:maxListPriceSelectedIndex]; bedroom = [bedroomList objectAtIndex:bedroomSelectedIndex]; fullBath = [fullBathList objectAtIndex:fullBathSelectedIndex]; sqFeet = [sqFeetList objectAtIndex:sqFeetSelectedIndex]; if (type != nil && [type length] > 0 && [type rangeOfString:@"All"].location == NSNotFound ){ [detailSearchURL appendString:@"&propertytype="]; [detailSearchURL appendString:type];
25
} if (status != nil && [status length] > 0 && [status rangeOfString:@"All"].location == NSNotFound ) { [detailSearchURL appendString: @"&status=" ]; [detailSearchURL appendString: status]; } . . . NSData * dataXml = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:detailSearchURL]]; XMLParserPropertyList *reader = [[[XMLParserPropertyList alloc] init] autorelease]; [reader parseXMLFile:dataXml]; self.propertyList = [[NSArray alloc] initWithArray:[[reader propertyList] retain]]; [dataXml release]; if([self.propertyList count] > 0){ PropertyListViewController *viewController = [PropertyListViewController alloc]; self.propertyListViewController = viewController; [viewController release]; [self.navigationController pushViewController:propertyListViewController animated:YES]; self.propertyListViewController.propertyList = nil; self.propertyListViewController.propertyList = self.propertyList; self.propertyListViewController.title = @"Property List"; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"No Property Found" message:@"Search tips to try:\n-Check search criteria\n-Try alternate spellings\n-Type partial entries" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [alertView show]; [alertView release]; } }
3.6 IMPLEMENTATION OF AGENT LIST Just like one can search for a property, in a similar way the user can search for a real
estate agent as well (see Figure 3.6). The search parameters are the following:
26
Figure 3.6. Agent list.
1. First name: It refers to the first name of the real estate agent.
2. Last Name: It refers to the last name of the real estate agent. 3. Listing Office: It refers to the listing office of the real estate agent.
When the user lands on the Agent List view, then AgentSearchTableViewController
comes into action. As in the other controllers, the first method to be called here is the
viewDidLoad, which actually sets up the navigation buttons and the cells for the various
search fields are created in cellForRowAtIndexPath method. Now, when the user inputs the
27
search criteria then it’s the doAgentSearch method which actually takes the values of the
different parameters and appends it over to the agentSearchURL. This URL then requests the
server for the data and the server responds back in form of XML data.
- (void) doAgentSearch:(id)sender { AgileAgentAppDelegate *appDelegate = (AgileAgentAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableString *agentSearchURL = [[NSMutableString alloc] initWithString:appDelegate.agentSerachURL]; if (firstName != nil && [firstName length] > 0){
[agentSearchURL appendString:@"&firstName="]; [agentSearchURL appendString:firstName];
} If (lastName != nil && [lastName length] > 0) {
[agentSearchURL appendString:@"&lastName="]; [agentSearchURL appendString:self.lastName];
} if (listingOffice != nil && [listingOffice length] > 0) {
[agentSearchURL appendString:@"&listingOffice="]; [agentSearchURL appendString:self.listingOffice];
} NSLog(@"%@",agentSearchURL); NSData * dataXml = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:agentSearchURL]]; XMLParserAgentList *reader = [[[XMLParserAgentList alloc] init] autorelease]; [reader parseXMLFile:dataXml]; self.agentList = [[NSArray alloc] initWithArray:[[reader agentList] retain]]; [dataXml release]; if([self.agentList count] > 0){ AgentListViewController *viewController = [AgentListViewController alloc]; self.agentListViewController = viewController; [viewController release]; [self.navigationController pushViewController:agentListViewController animated:YES]; self.agentListViewController.agentList = nil; self.agentListViewController.agentList = self.agentList; self.agentListViewController.title = @"Agent Listing"; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"No Agent Found" message:@"Search tips to try:\n-Check search criteria\n-Try alternate spellings\n-Type partial entries"
28
delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [alertView show]; [alertView release]; } }
Now the XML response from the server needs to be parsed which is done using
XMLParserAgentList. The output from here is an agentList which is then passed to the
AgentListViewController which displays the list of the Real estate agents with their names
and phone numbers. Now, when the user selects a particular cell or agent from this list, then
the agent details are extracted using XMLParserAgentDetails which are then passed to
AgentDetailViewController for this agent. Here the cellForRowAtIndexPath method is called
which actually renders the result which is the agent detail to the device UI.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease]; } NSUInteger row = [indexPath row]; switch (row) { case FullName:{
cell.textLabel.text=@"Name"; cell.detailTextLabel.text=agent.fullName; break; }
case Office:{ cell.textLabel.text=@"Office"; cell.detailTextLabel.text=agent.phone_direct_office; break;
} case Mobile:{
cell.textLabel.text=@"Mobile"; cell.detailTextLabel.text=agent.car_phone; break; }
case Email:{
29
cell.textLabel.text=@"Email"; cell.detailTextLabel.text=agent.member_email; break; }
case ListingOffice:{ cell.textLabel.text=@"Listing"; cell.detailTextLabel.text=agent.lo_name; break;
} } return cell; }
3.7 IMPLEMENTATION OF MORE MENU When the user is on the Property Details View, he can get some more specific
information about this property via the more option given to him (see Figure 3.7). This
option is available as a right navigation bar button on the top right corner of the Property
Details View. On the click of this button, the moreDetails method is called.
- (IBAction) moreDetails{ UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"More" delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"Cancel" otherButtonTitles:@"Show Map",@"Directions",@"To Show",@"Agent Info", @"Public Remarks",@"Realtor Remarks",nil]; popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque; [popupQuery showInView:self.view]; [popupQuery release]; }
The more menu is created using UIActionSheetDelegate along with the
PropertyDetailViewController and by over-riding the actionSheet:clickButtonAtIndex:
method.
The various choices available under ‘More’ are as follows.
3.7.1 Show Map When the user selects the ‘Show Map’ option from the More menu, the address, city,
state and zipcode of that property is passed to the MapViewController which has two
important functions of converting the address to latitude and longitude using Google’s
30
Figure 3.7. More menu.
webservice for Geo Code using the convertToCordinates method. The result of this method,
which is the latitudinal and longitudinal value of the location of the property is passed on the
showLocationonMap method.
NSString *makeGoogleMapsURL = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", [location stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSError* error = nil;
31
NSString *returnedCSVString = [NSString stringWithContentsOfURL:[NSURL URLWithString:makeGoogleMapsURL] encoding:NSASCIIStringEncoding error: &error]; NSArray *returnedArray = [returnedCSVString componentsSeparatedByString:@","]; if([returnedArray count] >= 4 && [[returnedArray objectAtIndex:0] isEqualToString:@"200"]) {
propLatitude = [[returnedArray objectAtIndex:2] doubleValue]; propLongitude = [[returnedArray objectAtIndex:3] doubleValue];
} else {
propLatitude = 0.0; propLongitude = 0.0;
} }
Now, the showLocationOnMap method uses these coordinates to pinpoint the
location of the property on mapView. In case the full address does not resolve to a valid
latitude and longitude value, then it uses just the zipcode of the property to get these
coordinates and display its location over the mapView.
-(void) showLocationOnMap{ //Remove all annotations from Map [mapView removeAnnotations:mapView.annotations]; //Set map to San Deigo by Default CLLocationCoordinate2D sanDiego = {latitude: 32.76572795, longitude: -117.07319880}; MKCoordinateSpan span = {latitudeDelta: 0.9, longitudeDelta: 0.5}; MKCoordinateRegion county = {sanDiego, span}; mapView.region = county; mapView.mapType = MKMapTypeStandard; mapView.showsUserLocation = YES; //Now Zoom to Location of Restaurant CLLocationCoordinate2D location = {latitude: propLatitude, longitude: propLongitude}; AnnotatedLocation *annotation = [[AnnotatedLocation alloc] init]; annotation.coordinate = location; annotation.title = @"Property"; annotation.subtitle = address; [mapView addAnnotation:annotation]; [annotation release];
32
//Zoom to Restaurant location MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(location, 2000, 2000); MKCoordinateRegion adjustedRegion = [mapView regionThatFits:viewRegion]; [mapView setRegion:adjustedRegion animated:YES];
}
3.7.2 Directions When the user selects the More menu option of Directions, he is able to see a pop up
dialog showing him the rough directions to the property. The following code snippet from
clickedButtonAtIndex method of PropetyDetailViewController is executed for showing this
dialog box.
titleHeader = @"Directions"; message = [labelValues objectForKey:@"directions"]; if ([ [message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] ] length]==0) message= @"No Direction Found"; [self showMessage];
3.7.3 To Show When the user selects the ‘To Show’ option from the more menu, it gives him the
instructions for looking at the property or scheduling any appointment to do so. The
following code snippet is implemented to perform this action.
titleHeader = @"To Show"; message = [NSString stringWithFormat:@"Instruction: %@ \n\nOwner: %@", [labelValues objectForKey:@"ftr_toshow"], [labelValues objectForKey:@"owner_name"]]; if ([ [message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] ] length]==0) message= @"No Data"; [self showMessage];
3.7.4 Agent Info If the user wants to see the information about the agent who is dealing with this
property, then he can choose the Agent Info option from the More menu.
agent = [[Agent alloc] init]; agent.fullName = [NSString stringWithFormat:@"%@ %@", [labelValues objectForKey:@"la_first_name"], [labelValues objectForKey:@"la_last_name"]];
33
agent.car_phone = [labelValues objectForKey:@"la_car_phone"]; agent.phone_direct_office = [labelValues objectForKey:@"la_phone_direct_office"]; agent.lo_name = [labelValues objectForKey:@"lo_name"]; agent.member_email = [labelValues objectForKey:@"la_member_email"]; if(agentDetailViewController == nil) { AgentDetailViewController *viewController = [[AgentDetailViewController alloc] InitWithStyle:UITableViewStyleGrouped]; self.agentDetailViewController = viewController; [viewController release]; } self.agentDetailViewController.agent = agent; self.agentDetailViewController.title = @"Agent Details"; [self.navigationController pushViewController:agentDetailViewController animated:YES];
It gets the agent details like full name, listing office, etc. and creates and Agent object
to pass to the AgentDetailViewController for display. Detailed information about
implementation of this feature has already been provided in the section 2.5 Implementation
of Agent List.
3.7.5 Public Remarks If the user wishes to see the comments of the general public about a property, then he
can select the Public Remarks option from the ‘More’ menu. This will thus display a pop up
dialog with the requested information.
3.7.6 Realtor Remarks Similarly, if the user wants to see the remarks of the realtors about any property, then
he can select the Realtor Remarks option from the ‘More’ menu. This will again display a
pop up dialog with the relevant information.
3.8 IMPLEMENTATION OF MORTGAGE CALCULATOR The user has also been provided with one more feature in this application, which is
the Mortgage Calculator. The user can feed in the Price for the property and the amount of
down payment, which he can make. Thus, depending on the number of years and interest rate
fed in by in the user, this mortgage calculator can provide the user with an estimate of
34
monthly P&I (Principal and Interest). For this calculateMortgage method is called from the
MortgageCalculatorController which actually calculates this result.
- (IBAction) calculateMortgage{ if ( ([purchasePrice length] > 0) && ([downPayment length] > 0) && ([interestRate length] > 0) && ([loanPeriod length] > 0)) { //Reading input data double dblPurchasePrice = [purchasePrice doubleValue]; double dblDownPayment = [downPayment doubleValue]; double dblInterestRate = [interestRate doubleValue]; int dblLoanPeriod = [loanPeriod intValue]; //Calculating double dblPrinciplePrice = dblPurchasePrice - dblDownPayment; double dblRate = dblInterestRate / 100.0; int totalPayments = dblLoanPeriod * 12; double tempRate = dblRate / 12; double Temp = 1 + tempRate; double sum = 1 + Temp; for (int i = 2; i <= totalPayments - 1; i++) {
Temp = Temp * (1 + tempRate); sum = sum + Temp;
} Temp = Temp * (1 + tempRate); double resultPI = (dblPrinciplePrice * Temp) / sum; //Setting Results loanAmount = [NSString stringWithFormat:@"$%.2f", dblPrinciplePrice]; monthlyPI = [NSString stringWithFormat:@"$%.2f", resultPI]; If( dblDownPayment < ((dblPurchasePrice * 20) / 100)) pmiRequired = @"Yes"; else
pmiRequired = @"NO"; MortgageCalcResultsController *viewController = [[MortgageCalcResultsController alloc] initWithStyle:UITableViewStyleGrouped]; self.mortgageCalcResultsController = viewController; [viewController release]; [self.navigationController pushViewController:mortgageCalcResultsController animated:YES]; self.mortgageCalcResultsController.title = @"Breakdown"; self.mortgageCalcResultsController.purchasePrice = [NSString stringWithFormat:@"$%@", purchasePrice]; self.mortgageCalcResultsController.downPayment = [NSString stringWithFormat:@"$%@", downPayment];
35
self.mortgageCalcResultsController.interestRate = [NSString stringWithFormat:@"%@%", interestRate]; self.mortgageCalcResultsController.loanPeriod =[NSString stringWithFormat:@"%@ years", loanPeriod]; self.mortgageCalcResultsController.loanAmount = self.loanAmount; self.mortgageCalcResultsController.monthlyPI = self.monthlyPI; self.mortgageCalcResultsController.pmiRequired = self.pmiRequired; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Missing Required Fields" message:@"Purchase Price, Loan Period, Down Payment and Interest Rate all are required to calculate the mortgage payments" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil]; [alertView show]; [alertView release]; }
Also, some validations have been performed here. For example, if any one of the
required fields do not have any value fed in them, and the user presses the calculate button, in
that case a pop up dialog with come up with an error message titled “Missing Required
Fields”. The results calculated here are now passed on the MortgageCalcResultsController.
Now, the results are displayed on the device UI by the cellForRowAtIndexPath method by
MortgageCalcResultsController.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; } if ([indexPath section] == 0) { switch (indexPath.row) { case 0:
cell.textLabel.text = @"Purchase Price"; cell.detailTextLabel.text = purchasePrice; break;
case 1: cell.textLabel.text = @"Down Payment";
36
cell.detailTextLabel.text = downPayment; break;
case 2: cell.textLabel.text = @"Loan Period"; cell.detailTextLabel.text = loanPeriod; break;
case 3: cell.textLabel.text = @"Interest Rate"; cell.detailTextLabel.text = interestRate; break;
} } else if([indexPath section] == 1) { switch (indexPath.row) { case 0:
cell.textLabel.text = @"Loan Amount"; cell.detailTextLabel.text = loanAmount; break;
case 1: cell.textLabel.text = @"Monthly PI"; cell.detailTextLabel.text = monthlyPI; break;
case 2: cell.textLabel.text = @"PMI Required?"; cell.detailTextLabel.text = pmiRequired; break;
} } return cell; }
37
CHAPTER 4
FINAL RESULTS
4.1 MLS SEARCH DEMO When the user enters the MLS Number in the MLS Search view, as shown in
Figure 4.1 and clicks the “Search” icon on the top right corner then the Property Details view
is displayed. This view shows the specific details about the property like status, type,
bedrooms, baths, heating, cooling, etc.
Figure 4.1. Demo of MLS search view and property details view.
38
4.2 MORE MENU DEMO When the user is on the ‘Property Details’ view, he has the option to get some more
information about the property like viewing the property on a map, getting directions to the
property, viewing the remarks, etc. In Figure 4.2 the more options menu is displayed and its
transition to next view when “Show Map” is selected, is also shown.
Figure 4.2. Demo of more menu and show map view.
Figure 4.3 demonstrates the view, which would be seen when the user selects the
“Directions” and “To Show” options.
The users have an option to directly view the details of the agent who is associated
with the property he is currently viewing, by selecting the ‘Agent Info’ option. Also the user
39
Figure 4.3. Demo of directions and to show view.
can view the public comments on that property by selecting the “Public Remarks” option (see
Figure 4.4).
Lastly, in this view the user also has the option to see the comments from the realtor
on that property by selecting the ‘Realtor Remarks’ option (see Figure 4.5).
4.3 QUICK SEARCH DEMO Figure 4.6 shows the view when the user selects the ‘Quick Search’ option from the
tab bar menu. When the user enters the search parameters and selects the ‘Search’ icon, the
Property List view is displayed. It displays the list of property along with their MLS Number,
price, area, etc.
40
Figure 4.4. Demo of agent info and public remarks view.
The user can select any property from the Property List view, which would take the
user to the detail view of the property. When the user enters any invalid search parameter the
alert message suggesting the search tips is displayed (see Figure 4.7).
4.4 DETAIL SEARCH DEMO Then comes the Detail Search view, which has more search parameters to narrow
down your property search. Again, if the user search criteria doesn’t result in any property, a
search tip is displayed (see Figure 4.8).
41
Figure 4.5. Demo of realtor remarks view.
4.5 AGENT LIST DEMO When the user selects the Agent List menu option, the Agent List view is shown, with
options to search an agent on his First name, Last name and the Listing office which he
belongs to. The search will take the user to the Agent Listing view (see Figure 4.9).
The user can select a specific agent from the Agent Listing view to get more details
about that agent like his phone number, email address, etc. (see Figure 4.10). When there is
no agent matching the search criteria then a search tip is displayed.
42
Figure 4.6. Demo of quick search view and property list view.
4.6 MORTGAGE CALCULATOR DEMO The user can also get the estimate of the mortgage using the Mortgage calculator
option. He can enter the details like purchase price, down payment, loan years and interest to
get the mortgage breakdown as shown in Figure 4.11.
If an invalid value is entered or the required fields are left empty, then the alert
message is displayed to the user for the same as shown in Figure 4.12.
43
Figure 4.7. Demo of property detail view and no property alert.
44
Figure 4.8. Demo of detail search view and no property alert.
45
Figure 4.9. Demo of agent search view and agent list view.
46
Figure 4.10. Demo of agent details view and no agent alert.
47
Figure 4.11. Demo of mortgage calculator view and its result breakdown view.
48
Figure 4.12. Demo of missing fields alert.
49
CHAPTER 5
COMPARATIVE STUDY WITH ANDROID
In this chapter we undertake a comparative study of iPhone with Android [11], [12],
[13]. The following points illustrate some key aspects and differences in the platforms.
5.1 DEVELOPMENT ENVIRONMENTS Both the iPhone and Android development environment come with an IDE, simulator
and some debugging tools. But, officially iPhone development can only be done on a Mac
and in Objective-C. On the other hand, Android development can be done on all major OS
using Eclipse IDE, and using Java as the programming language.
5.2 PROGRAMMING EASE Objective-C is primarily used only on Apple’s Mac OS X and for iOS development
whereas Java is one of the most popular programming languages. Learning Objective-C
requires a higher learning curve and the developer has to do a lot because of its lack of
memory management. Although Java is more intuitive, also due to Garbage collection in
Java, it doesn’t require dealing with painful memory management bugs. The only thing in
Android is that you have to support multiple devices, and debug device specific bugs.
Providing cross device compatibility becomes an issue for Android developers.
5.3 HANDLING APPLICATION STORES Apple is controlling all its application on Apple Store, and keeps the decision upon
itself to approve or deny it. In addition you have to get through a lot of hurdles before getting
your application to the Apple Store. Whereas Google more permissive about its Android
Marketplace, and also makes it relatively easy to point their device at another application
store.
Also due to the huge and growing market of Android, and due to the free precedent
set by Google, it is less likely for people to pay for the applications as compared to iPhone.
50
5.4 DOCUMENTATION Apple’s reference guides, tutorials and documentation are very complete. Also the
large numbers of iPhone developers have contributed to the wealth of information online.
Apart from this, the library documentation provided by Google is not as complete as apple,
but the strong development community provides solid support.
5.5 TOOLS The iPhone SDK and XCode IDE bundles up with some great debugging and
performance monitoring tools like NSZombie, Instruments, etc., whereas Android doesn’t
come with this level of performance and debugging support.
5.6 USER EXPERIENCE It is a known fact that Apple has always excelled in one area, which is user
experience. Thus the iPhone Operating System has also laid a large emphasis on this. This is
the main reason, which makes iPhone very popular and a fun to use device, as compared to
any other OS or devices.
5.7 EXPANDABLE MEMORY Since iPhone OS doesn’t allow the use of external memory card, the user is restricted
to the internal memory of the Phone. Thus the OS and the application all reside in the same
memory. But on the other hand, Android OS allows the use of an external memory card. So
the user is not limited to the internal storage space on the device. The user can have multiple
memory cards for storing different data like movies, music and apps and switch them when
needed.
5.8 PROCESS JUGGLING Since the iPhone application doesn’t allow using external memory cards, the iPhone
applications are written keeping in mind that the application and OS use the same partition.
So the user doesn’t have to perform the juggling of processes between different memories,
which is very valuable. On the other hand Android phones normally comes with
comparatively less internal memory and with an expandable memory slot. So the OS and
51
most of the applications reside on separate partitions, which lead Android to run into the
problem of having to juggle the tiny amount of internal memory.
5.9 OPENNESS Android OS is open source, and the user has no restrictions as to what they can run on
these devices. As the result, they are lot of free application available on the phone.
Finally, they are a lot more differences and pros and cons of each one of them based
on factors like battery life, software keyboard, notification center, gaming, free turn-by-turn
navigation, customization, music player, release and update consistency, etc., which makes
each one of them better then the other in certain aspects.
52
CHAPTER 6
CURRENT LIMITATIONS
This application is not perfect. While comparing the features in this application and
the ones existing and while analyzing various usability things, I discovered that it has various
limitations. But, the good thing is that none of these limitations are a hindrance in the proper
functionality of this application. First and one of the most important ones is lack of sessions.
Session Management has not been done in this version of this application. Because of a lack
of this feature, every-time when the user queries the database, the results cannot be saved.
So, the user might need to run the same query again and again, when he uses the application.
The second important thing missing is dynamic routing. So, suppose when the user is
on the way to see a property, there is no way that the other available properties on the route
he is taking, can be shown. If this feature is there, then the user can see a lot of properties on
the way and this can make up his mind to approach further to see or not to see the property.
Related to this is another limitation that, as of now, though the location of the property is
shown on the Google Maps, but from the user’s current location, the accurate directions to
the property are missing.
Also, the user can not send the information about a property or the whole list of
properties to himself or anyone else over the email. So, lack of email option, is one of the
other limitations.
Now, think of when a user gets the information about the property, what one thing he
will want to have a look at. Yes, pictures of the property. Now, in this version of the
application, the user cannot see the pictures of the property.
Another improvement can be in the area of providing the accurate P&I for the
property. In the current version, various hidden costs like closing, commission, insurance are
not taken care of when calculating the monthly P&I. Also, depending on the location of the
property, a lot of parameters change while calculating the monthly P&I. A lot of these factors
are not taken into account as of now and this is not an accurate estimation of monthly P&I.
53
After a few users get a chance to use this application, there is a possibility that a few
more limitations will be brought into notice and then accordingly, all of those will be dealt to
provide a better solution.
54
CHAPTER 7
FUTURE IMPROVEMENTS
Now, as I have some idea on the current existing limitations of this application, in
future or may be the next step is to eliminate all of those limitations one by one. Once these
limitations are removed, then some new features will be added to the application.
So, the first thing that will be worked upon in the future is session management.
Once this limitation is removed, the users will have the ability to save their search
results and they do not have to waste time on searching the same thing again and again, every
other time when they use the application. Also, since there will be a login and logout
mechanism now, it will be easier to keep an eye on any malicious activity. This will add to
the enhanced security feature aspect of the application.
Once the session management is in there, then the user can also be provided with
email option to send his saved results to some email address. Then, after searching, any
information could be emailed. Anytime the user wants to access the information, he can
access his email, even if he does not have access to his mobile device.
Implementation of the dynamic routing feature is more of an enhancement than a
limitation. This will be a cool new feature, where the user will be able to see the properties
which are available for buying or renting purposes, while he is on the move. So, suppose I
am driving towards any point and on the map, it will pop up various properties which are
available. This feature sounds really great and will be fun to implement.
Alongside of the dynamic routing, another feature that will be implemented is
providing accurate directions from the user’s current location. So, it will eliminate the need
of going to Google Maps or any other navigation application or website or use of a GPS.
Once this feature is embedded in to the application, the user will directly be able to select
‘Get Directions’ from the options menu and get what is desired.
One feature, which will be in there for sure in the next version of the application is
the pictures of the property. After this has been implemented, the user will be able to see the
55
pictures of almost all the properties. This will help the user to shortlist a property on the first
look and thus, will help him make up his mind.
Another limitation of this application is not providing the user with an accurate
estimation of the monthly P&I. Now, in the next version of this application, all the
parameters which govern this calculation will be taken into account. The location of the
property, the bank information, static and variable interest rates, etc., all will be considered.
Thus, the user will be provided with a more accurate estimate on the monthly P&I or the
mortgage.
I am also planning to add a Help and Contact US, menu option in the menu bar, so
that, if the user has any problems, either he can go the documentation in Help or can directly
contact us for queries and feedbacks. This will help me in satisfying the needs of the users.
56
CHAPTER 8
SUMMARY
The development of this application started after I came in contact with a group of
people who wanted a similar application for iPhone. After a few discussions with them and
my thesis committee, I started working on this application. I followed the simple SDLC
(Software Development Life Cycle) methodology and started gathering requirements first. I
also studied a few of the existing applications like Trulia and websites like Zillow and tried
to understand how they work, what approach they take to return a response back to the user,
what features they have and what features they do not have.
After this, some good amount of time was spent on designing the blueprint of the
application. Some designs were made for UI, decisions were taken like what kind of search
options will be implemented, how the flow of the application will be in the application.
The next step after this was to actually implement all of these features one by one.
First thing which was required was to parse the XML data which is returned after the web
services hit the database. This XML data is parsed using XMLParserDelegate. After parsing,
the whole data was displayed on the mobile’s UI accordingly in a very lucid manner, so that
the user can read and understand the information over there without any problem. This
solved the purpose for MLS Search, Quick Search, Detailed Search and Agent Search.
Then next step was to show the location of the property on a map. For implementing
this feature a Mapkit framework was used. This feature helps the user to have an idea of
where the property is located. This will be of a great help to the users.
The next important thing, which was implemented was Mortgage Calculator. Some
information was collected on how the mortgages are calculated but not all the factors are
considered while implementing this. It gives the user a rough estimate of the monthly P&I on
a property.
I have kept my level best to keep the application simple, very easy to use and user
friendly. The user will not find it difficult navigating over the different features or using any
feature of the application. With some good thorough testing, I have tried to keep the
57
application error free. But, still if some bug is found or reported, it will be fixed as soon as
possible. There is always a scope of improvements, so new features will be added constantly
as the application grows and matures.
58
CHAPTER 9
CONCLUSION AND OBSTACLES
Now, at the end I would like to conclude the work, which I have done in this
application, and the obstacles that I faced during the term of the project. Also I would discuss
about what could have been done better, if I had to build this project again from scratch.
During the course of this project my main focus was to provide different kinds of
search criteria and allow the user to access all the details about the property. But what could
have been done better was to focus more on integrating this application seamlessly with
Google maps to do more interesting things like getting directions to the property from the
users current location, seeing what’s nearby the property, for example schools, hospitals,
grocery stores, etc., which could have been interesting for users. Also I could have provided
user with an option to save their searches and share the property of interest with their friends
and relatives.
Also during this project, I had to face a lot of obstacles, like interacting with the team
on the server side to get some information. Sometimes, it was a wait of several days, to get a
response from them, because they were involved in various other projects too. Furthermore,
there was a huge learning curve involved in learning mobile platforms and learning a new
language like Objective-C for development.
In all, I think they were a lot of things, which could be done with this application,
which would be kept in mind in future versions. But, I believe the initial version of this
application is capable of fulfilling the basic needs of the user.
59
BIBLIOGRAPHY
[1] eHow. MLS Numbers, 2011. http://www.ehow.com/how-does_4913229_mls-numbers-work.html, accessed Oct. 2011.
[2] Paul J. Kershaw, Robin R. Kooymans, and Peter A. Rossini. “Developing Specialized Software for Real Estate Applications: A Case Study of the Development of Upmarket.” Proceedings of the Pacific Rim Real Estate Society Conference, Gold Coast, Queensland, 1996. PRRES.
[3] Wikipedia. Mobile Operating System, 2011. http://en.wikipedia.org/wiki/Mobile_operating_system, accessed Oct. 2011.
[4] Trulia. Homepage, 2011. http://www.trulia.com/, accessed Oct. 2011. [5] Zillow. Homepage, 2011. http://www.zillow.com, accessed Oct. 2011.
[6] Apple. iOS Overview, 2010. http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/URL_iPhone_OS_Overview/_index.html%23//apple_ref/doc/uid/TP40007592, accessed Oct. 2011.
[7] Apple. Learning Objective-C: A Primer, 2010. http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html, accessed Oct. 2011.
[8] Apple. iOS App Programming Guide, 2011. http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf, accessed Oct. 2011.
[9] Wikipedia. iOS SDK, 2011. http://en.wikipedia.org/wiki/IOS_SDK, accessed Oct. 2011.
[10] Apple. About the iOS App Development Workflow, 2011. http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/000-Introduction/introduction.html, accessed Oct. 2011.
[11] David Quail. iPhone vs Android vs webOS from a Developers Point of View, 2010. http://davidquail.com/2010/09/15/iphone-vs-android-vs-webos-from-a-developers-point-of-view/, accessed Oct. 2011.
[12] Adam Pash. iPhone vs. Android Showdown: Which Phone Is Best for Power Users?, 2010. http://lifehacker.com/5559357/iphone-vs-android-showdown-which-phone-is-best-for-power-users, accessed Oct. 2011.
[13] A Comparative Study of the Android and iPhone Operating Systems. Travis Wooley, 2010.