- (void)viewWillAppear:(BOOL)animated {};
或
- (void)viewDidAppear:(BOOL)animated {};
所以必須要注意不要在這
Calling
pushViewController before viewDidAppear is unsafe.pushViewController before viewDidAppear is unsafe.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[NSLocale currentLocale]];
[dateFormatter setDateFormat:@"yyyy-mm-dd HH:mm:ss Z"];
NSLog(@"結束時間 is %@",[dateFormatter stringFromDate:[NSDate date]]);
NSString *date_str = [id_news objectForKey:@"pubdate"];
NSLog(@"date_str is %@",date_str);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[dateFormatter setLocale:usLocale];
[dateFormatter setDateFormat:@"EEE, dd MMMM yyyy HH:mm:ss Z"];
[dateFormatter dateFromString:date_str];
NSDate *date = [dateFormatter dateFromString:date_str];
NSLog(@"date is %@",date);
NSDateFormatter *form = [[NSDateFormatter alloc] init];
[form setDateFormat:@"yyyy-MM-dd"];
NSString *dateStr = [NSString stringWithFormat:@"%@", [form stringFromDate:date]];
NSLog(@"dateStr is %@",dateStr);
2013-02-21 16:42:00.943 Tainan[3246:4d1b] date_str is Wed, 20 Feb 2013 00:00:00 GMT
2013-02-21 16:42:00.948 Tainan[3246:4d1b] date is 2013-02-20 00:00:00 +0000
2013-02-21 16:42:00.950 Tainan[3246:4d1b] dateStr is 2013-02-20
NSString *url_str = [NSString stringWithFormat:@"%@%@&Keyword=%@", area_cate_poi_str, AppDelegate.lag_id, searchbar.text];
NSLog(@"getPoiServer url_str is %@", url_str);
NSURL *url = [NSURL URLWithString:url_str];
NSLog(@"url is %@", url);
ASIHTTPRequest *request_poi = [ASIHTTPRequest requestWithURL:url];
[request_poi setDelegate:self];
[request_poi startAsynchronous];
2013-02-04 17:10:26.634 Tainan[17738:207] getPoiServer url_str is http://202.3.189.133/tainan/API/poi.php?type=title&lang_id=1&Keyword=台南
2013-02-04 17:10:26.634 Tainan[17738:207] url is (null)
NSString *url_str = [NSString stringWithFormat:@"%@%@&Keyword=%@", area_cate_poi_str, AppDelegate.lag_id, searchbar.text];
url_str = [url_str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:url_str];
NSLog(@"url url_str is %@", url);
ASIHTTPRequest *request_poi = [ASIHTTPRequest requestWithURL:url];
[request_poi setDelegate:self];
[request_poi startAsynchronous];
2013-02-04 17:20:40.530 Tainan[17772:207] getPoiServer url_str is http://202.3.189.133/tainan/API/poi.php?type=title&lang_id=1&Keyword=台南
2013-02-04 17:20:40.530 Tainan[17772:207] url is http://202.3.189.133/tainan/API/poi.php?type=title&lang_id=1&Keyword=%E5%8F%B0%E5%8D%97