Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added rotation and ipad code #3

Open
wants to merge 3 commits into from

1 participant

This page is out of date. Refresh to see the latest.
View
30 Classes/PullRefreshTableViewController.m
@@ -32,7 +32,6 @@
#define REFRESH_HEADER_HEIGHT 52.0f
-
@implementation PullRefreshTableViewController
@synthesize textPull, textRelease, textLoading, refreshHeaderView, refreshLabel, refreshArrow, refreshSpinner;
@@ -40,26 +39,45 @@ @implementation PullRefreshTableViewController
- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self != nil) {
- textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."];
- textRelease = [[NSString alloc] initWithString:@"Release to refresh..."];
- textLoading = [[NSString alloc] initWithString:@"Loading..."];
+ [self performSelector:@selector(setup)];
+ }
+ return self;
+}
+
+- (id)initWithCoder:(NSCoder *)aDecoder {
+ self = [super initWithCoder:(NSCoder *)aDecoder];
+ if (self != nil) {
+ [self performSelector:@selector(setup)];
}
return self;
}
+- (void)setup {
+ textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."];
+ textRelease = [[NSString alloc] initWithString:@"Release to refresh..."];
+ textLoading = [[NSString alloc] initWithString:@"Loading..."];
+}
+
- (void)viewDidLoad {
[super viewDidLoad];
[self addPullToRefreshHeader];
}
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
+ return YES;
+}
+
- (void)addPullToRefreshHeader {
- refreshHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0 - REFRESH_HEADER_HEIGHT, 320, REFRESH_HEADER_HEIGHT)];
+ CGFloat width = [[UIScreen mainScreen] bounds].size.width;
+ refreshHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0 - REFRESH_HEADER_HEIGHT, width, 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, width, REFRESH_HEADER_HEIGHT)];
refreshLabel.backgroundColor = [UIColor clearColor];
refreshLabel.font = [UIFont boldSystemFontOfSize:12.0];
refreshLabel.textAlignment = UITextAlignmentCenter;
+ refreshLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
refreshArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]];
refreshArrow.frame = CGRectMake((REFRESH_HEADER_HEIGHT - 27) / 2,
View
9 PullToRefresh.xcodeproj/project.pbxproj
@@ -143,6 +143,7 @@
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "PullToRefresh" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
@@ -222,8 +223,10 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.2;
PREBINDING = NO;
- SDKROOT = iphoneos4.0;
+ SDKROOT = iphoneos4.1;
+ TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
@@ -235,9 +238,11 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.2;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
- SDKROOT = iphoneos4.0;
+ SDKROOT = iphoneos4.1;
+ TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Something went wrong with that request. Please try again.