Permalink
Browse files

Merge pull request #20 from wrapp/dateformatting

Localize date based on user's region
  • Loading branch information...
2 parents f4779a2 + 7e51010 commit 743679ffeb6ac02f0afffaac46f318dd2ce6122e @shnhrrsn shnhrrsn committed May 30, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 EGOTableViewPullRefresh/Classes/View/EGORefreshTableHeaderView.m
@@ -41,7 +41,7 @@ @implementation EGORefreshTableHeaderView
- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor {
- if (self = [super initWithFrame:frame]) {
+ if((self = [super initWithFrame:frame])) {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.backgroundColor = [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0];
@@ -112,14 +112,14 @@ - (void)refreshLastUpdatedDate {
NSDate *date = [_delegate egoRefreshTableHeaderDataSourceLastUpdated:self];
- NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
- [formatter setAMSymbol:@"AM"];
- [formatter setPMSymbol:@"PM"];
- [formatter setDateFormat:@"MM/dd/yyyy hh:mm:a"];
- _lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [formatter stringFromDate:date]];
+ [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehaviorDefault];
+ NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
+ [dateFormatter setDateStyle:NSDateFormatterShortStyle];
+ [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
+
+ _lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [dateFormatter stringFromDate:date]];
[[NSUserDefaults standardUserDefaults] setObject:_lastUpdatedLabel.text forKey:@"EGORefreshTableView_LastRefresh"];
[[NSUserDefaults standardUserDefaults] synchronize];
- [formatter release];
} else {

1 comment on commit 743679f

ssmony commented on 743679f Mar 18, 2013

Thank you for sharing. I have a problem when I have a banner at the bottom of the tableView and your refresh on top, the banner always cover the tableView. How can I get rid of it. Thanks.

Please sign in to comment.