to display weather forecast for currentday,next day and day after next day in iphone [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years a开发者_开发百科go.
Improve this questionHi i want to create a weather application.My weather application is such that when user clicks on weather tab weather details of the current location should be displayed in table view.For the same current location,weather details for the current day ,next day and day after next day should be displayed in tableview.please anybody give me any sort of code or any link on how this is possible in iphone. Thanks
You will have to use NSDate
,
First Construct an NSDate
object with current time
NSDate *today = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"HH:mm:ss"];
NSString *currentTime = [dateFormatter stringFromDate:today];
[dateFormatter setDateFormat:@"dd.MM.yyyy"];
NSString *currentDate = [dateFormatter stringFromDate:today];
Now currentDate
is the string object, you can display it with UILabel
on screen,
likewise you could create date and get the string object for Next day .....
WeatherAPI
These are not iPhone specific, but free weather APIs.
NOAA REST Interface
Example: http://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdXMLclient.php?zipCodeList=90210&product=time-series&begin=2004-01-01T00:00:00&end=2013-04-21T00:00:00&maxt=maxt&mint=mint
Yahoo! Weather Forecast RSS
Example: http://weather.yahooapis.com/forecastrss?p=90210
Google Weather API - documentation URL for this?
Example: http://www.google.com/ig/api?weather=90210
Weather Underground API
Example: http://api.wunderground.com/auto/wui/geo/GeoLookupXML/index.xml?query=90210
Weather Channel - Requires signup
Example: found sample code at github. Ruby gem for accessing the Weather Channel XML API
WeatherAPI (Norway)
Example: http://api.yr.no/weatherapi/locationforecast/1.6/?lat=34;lon=-118
To display weather information in application you can use the following weather data feed(supports the following formats XML/JSON/CSV).
Weather API
You can use TouchXML for parsing XML(if the data feed return type is XML fromat).
TouchXML
精彩评论