From ba6e005ccf01106df50ffe305d8ef2a7c1ac56af Mon Sep 17 00:00:00 2001 From: Hector Zarate Date: Tue, 10 Jan 2012 18:47:37 -0800 Subject: [PATCH 1/2] Added NSLocalizedString to strings Added NSLocalizedString macro to the strings. --- Classes/PullRefreshTableViewController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/PullRefreshTableViewController.m b/Classes/PullRefreshTableViewController.m index 6bc4ebe..87152fe 100644 --- a/Classes/PullRefreshTableViewController.m +++ b/Classes/PullRefreshTableViewController.m @@ -67,9 +67,9 @@ - (void)viewDidLoad { } - (void)setupStrings{ - textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."]; - textRelease = [[NSString alloc] initWithString:@"Release to refresh..."]; - textLoading = [[NSString alloc] initWithString:@"Loading..."]; + textPull = [[NSString alloc] initWithString:NSLocalizedString(@"Pull down to refresh...", @"Pull down to refresh...")]; + textRelease = [[NSString alloc] initWithString:NSLocalizedString(@"Release to refresh...", @"Release to refresh...")]; + textLoading = [[NSString alloc] initWithString:NSLocalizedString(@"Loading...", @"Loading...")]; } - (void)addPullToRefreshHeader { From 02e06e6df902a3b02297e87415c7b46b063c322f Mon Sep 17 00:00:00 2001 From: Hector Zarate Date: Tue, 10 Jan 2012 19:14:31 -0800 Subject: [PATCH 2/2] RefreshHeaderView now occupies 100% of width Useful for extra wide tables: iPad and rotated iPhones. --- Classes/PullRefreshTableViewController.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Classes/PullRefreshTableViewController.m b/Classes/PullRefreshTableViewController.m index 87152fe..17d6d5b 100644 --- a/Classes/PullRefreshTableViewController.m +++ b/Classes/PullRefreshTableViewController.m @@ -73,11 +73,16 @@ - (void)setupStrings{ } - (void)addPullToRefreshHeader { - refreshHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0 - REFRESH_HEADER_HEIGHT, 320, REFRESH_HEADER_HEIGHT)]; + + CGFloat tableWidth = self.tableView.frame.size.width; + + refreshHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0 - REFRESH_HEADER_HEIGHT, tableWidth, REFRESH_HEADER_HEIGHT)]; refreshHeaderView.backgroundColor = [UIColor clearColor]; + refreshHeaderView.autoresizingMask = UIViewAutoresizingFlexibleWidth; - refreshLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, REFRESH_HEADER_HEIGHT)]; + refreshLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableWidth, REFRESH_HEADER_HEIGHT)]; refreshLabel.backgroundColor = [UIColor clearColor]; + refreshLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; refreshLabel.font = [UIFont boldSystemFontOfSize:12.0]; refreshLabel.textAlignment = UITextAlignmentCenter;