Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials > Tutorial Requests

Reply
 
LinkBack Thread Tools Display Modes
Old 08-09-2010, 01:20 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 4
ruchido is on a distinguished road
Wink How to use the URL to fill the picker

Hi Guys,

that is my first post here. Im a new iPhone developer and Im developing an app which must fill the picker with sources from a web service.

for example a postal code:

you type the postal code and in a picker you choose your city.

the web service is working and Im able to get the information, but as it has too many nodes I want to create a picker such as a filter.

Thanks for you attemption and sorry if it's a stupid question...
ruchido is offline   Reply With Quote
Old 08-15-2010, 09:14 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 4
ruchido is on a distinguished road
Default

Could someone please help with this? I want to fill the picket with the content of a web service.
ruchido is offline   Reply With Quote
Old 08-18-2010, 05:39 AM   #3 (permalink)
14 Year Old iOS Developer
 
H4CK3R's Avatar
 
Join Date: Jun 2010
Age: 16
Posts: 73
H4CK3R is on a distinguished road
Default

You could try having the web service setup so it you pass "&output=total&postcode=?????" then it just prints to the page (no html or anything) the number of citys matching that postcode.

(an example would be something like this)
http://modmyi.com/cstats/index.php?p...ro&output=text

Then also
&output=text&postcode=????&city=1"
in the url like this would produce the of the first city with that postcode match.

This way you could do something like this.
(very simplified code)
Code:
//Setup
NSArray *options;

int total;
int requests;

requests = 1;



NSData *totalcities = [dataWithContentsOfURL:@"http://site.com/app/postcode.php?&output=total&postcode=%@", postcode];

total = totalcities; 


for(int i = requests; i <= total; i++)
{
NSData *temp = [NSData dataWithContentOfURL:@"http://site.com/app/postcode.php?&output=text&postcode=%@&city=%@", postcode, requests];

NSString = *temp2;
tem2 = [NSString stringwithformat:temp];

[options addObject:temp2];

requests++

}
And i haven't used NSPickers before but you'd probably do something like.

UIPickerView *cities = [UIPicker withNumberOfOptions:total];

and then fill the options with the array created above.

Sorry it's a bit messy but i hope you get the idea.

Last edited by H4CK3R; 08-18-2010 at 05:42 AM.
H4CK3R is offline   Reply With Quote
Reply

Bookmarks

Tags
nsurl, picker, textview, url, view

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 442
19 members and 423 guests
cgokey, dcool, Dj_kades, Droverson, givensur, iAppDeveloper, iekei, ipodphone, karatebasker, laureix68, LunarMoon, patapple, Paul Slocum, peterwilli, pipposanta, QuantumDoja, SLIC, Sloshmonster, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,696
Threads: 94,139
Posts: 402,961
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jasper_muc
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:04 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0