Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Created SSRatingPickerViewController

  • Loading branch information...
commit 204ac326febb85960fc49c51a2619b05de31aa3e 1 parent e23d4d9
@soffes soffes authored
View
17 SSCatalog/Classes/SCRatingPickerDemoViewController.h
@@ -1,17 +0,0 @@
-//
-// SCRatingPickerDemoViewController.h
-// SSCatalog
-//
-// Created by Sam Soffes on 2/2/11.
-// Copyright 2011 Sam Soffes. All rights reserved.
-//
-
-@interface SCRatingPickerDemoViewController : UIViewController {
-
-}
-
-+ (NSString *)title;
-
-- (void)ratingChanged:(id)sender;
-
-@end
View
63 SSCatalog/Classes/SCRatingPickerDemoViewController.m
@@ -1,63 +0,0 @@
-//
-// SCRatingPickerDemoViewController.m
-// SSCatalog
-//
-// Created by Sam Soffes on 2/2/11.
-// Copyright 2011 Sam Soffes. All rights reserved.
-//
-
-#import "SCRatingPickerDemoViewController.h"
-#import <SSToolkit/SSGradientView.h>
-#import <SSToolkit/SSRatingPicker.h>
-
-@implementation SCRatingPickerDemoViewController
-
-#pragma mark Class Methods
-
-+ (NSString *)title {
- return @"Rating Picker";
-}
-
-
-#pragma mark UIViewController
-
-- (void)viewDidLoad {
- [super viewDidLoad];
- self.title = [[self class] title];
- self.view.backgroundColor = [UIColor whiteColor];
-
- SSGradientView *gradientView = [[SSGradientView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)];
- gradientView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
- gradientView.topColor = [UIColor colorWithRed:0.878f green:0.890f blue:0.906f alpha:1.0f];
- gradientView.bottomColor = [UIColor colorWithRed:0.961f green:0.965f blue:0.973f alpha:1.0f];
- gradientView.bottomBorderColor = [UIColor colorWithRed:0.839f green:0.839f blue:0.839f alpha:1.0f];
- gradientView.hasTopBorder = NO;
- gradientView.hasBottomBorder = YES;
- gradientView.showsInsets = NO;
- [self.view addSubview:gradientView];
- [gradientView release];
-
- SSRatingPicker *picker = [[SSRatingPicker alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)];
- picker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
- picker.backgroundColor = [UIColor clearColor];
- [picker addTarget:self action:@selector(ratingChanged:) forControlEvents:UIControlEventValueChanged];
- [self.view addSubview:picker];
- [picker release];
-}
-
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
- return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
- }
- return YES;
-}
-
-
-#pragma mark Actions
-
-- (void)ratingChanged:(id)sender {
- NSLog(@"Rating: %0.1f", [sender numberOfStars]);
-}
-
-@end
View
2  SSCatalog/Classes/SCRootViewController.m
@@ -50,7 +50,6 @@ - (void)viewDidLoad {
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObjects:
- @"SCRatingPickerDemoViewController",
@"SCSwitchDemoViewController",
nil], kClassesKey,
@"Controls", kTitleKey,
@@ -58,6 +57,7 @@ - (void)viewDidLoad {
[NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObjects:
@"SCPickerDemoViewController",
+ @"SSRatingDemoViewController",
nil], kClassesKey,
@"View Controllers", kTitleKey,
nil],
View
17 SSCatalog/Classes/SSRatingDemoViewController.h
@@ -0,0 +1,17 @@
+//
+// SSRatingDemoViewController.h
+// SSCatalog
+//
+// Created by Sam Soffes on 2/3/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import <SSToolkit/SSRatingPickerViewController.h>
+
+@interface SSRatingDemoViewController : SSRatingPickerViewController {
+
+}
+
++ (NSString *)title;
+
+@end
View
27 SSCatalog/Classes/SSRatingDemoViewController.m
@@ -0,0 +1,27 @@
+//
+// SSRatingDemoViewController.m
+// SSCatalog
+//
+// Created by Sam Soffes on 2/3/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import "SSRatingDemoViewController.h"
+
+@implementation SSRatingDemoViewController
+
+#pragma mark Class Methods
+
++ (NSString *)title {
+ return @"Rating Picker";
+}
+
+
+#pragma mark UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = [[self class] title];
+}
+
+@end
View
12 SSCatalog/SSCatalog.xcodeproj/project.pbxproj
@@ -28,7 +28,7 @@
B27B1CD612248F9D00111EA2 /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CCC12248F9D00111EA2 /* Icon-57.png */; };
B27B1CD712248F9D00111EA2 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CCD12248F9D00111EA2 /* Icon-114.png */; };
B27B1CD812248F9D00111EA2 /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CCE12248F9D00111EA2 /* iTunesArtwork */; };
- B282192112FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B282192012FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.m */; };
+ B28C6D0B12FBE96600667755 /* SSRatingDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B28C6D0A12FBE96600667755 /* SSRatingDemoViewController.m */; };
B2B3CEEF1296F78D001BAC94 /* SCSwitchDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2B3CEEE1296F78D001BAC94 /* SCSwitchDemoViewController.m */; };
B2B3CF561296FA76001BAC94 /* SSToolkit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B2B3CF551296FA76001BAC94 /* SSToolkit.bundle */; };
B2E0323F121DC49700D02434 /* libSSToolkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B24E9ECA121DC3CF0085F81E /* libSSToolkit.a */; };
@@ -92,8 +92,8 @@
B27B1CCD12248F9D00111EA2 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = "<group>"; };
B27B1CCE12248F9D00111EA2 /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = "<group>"; };
B27B1CCF12248F9D00111EA2 /* SSCatalog-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SSCatalog-Info.plist"; sourceTree = "<group>"; };
- B282191F12FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCRatingPickerDemoViewController.h; sourceTree = "<group>"; };
- B282192012FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCRatingPickerDemoViewController.m; sourceTree = "<group>"; };
+ B28C6D0912FBE96600667755 /* SSRatingDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSRatingDemoViewController.h; sourceTree = "<group>"; };
+ B28C6D0A12FBE96600667755 /* SSRatingDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSRatingDemoViewController.m; sourceTree = "<group>"; };
B2B3CEED1296F78D001BAC94 /* SCSwitchDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCSwitchDemoViewController.h; sourceTree = "<group>"; };
B2B3CEEE1296F78D001BAC94 /* SCSwitchDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCSwitchDemoViewController.m; sourceTree = "<group>"; };
B2B3CF551296FA76001BAC94 /* SSToolkit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SSToolkit.bundle; path = ../Resources/SSToolkit.bundle; sourceTree = SOURCE_ROOT; };
@@ -237,6 +237,8 @@
B24E9EA3121DC35B0085F81E /* SCPickerDemoViewController.m */,
B24E9EA4121DC35B0085F81E /* SCPickerDetailViewController.h */,
B24E9EA5121DC35B0085F81E /* SCPickerDetailViewController.m */,
+ B28C6D0912FBE96600667755 /* SSRatingDemoViewController.h */,
+ B28C6D0A12FBE96600667755 /* SSRatingDemoViewController.m */,
);
name = "View Controller Demos";
sourceTree = "<group>";
@@ -244,8 +246,6 @@
B2B3CEFF1296F88B001BAC94 /* Control Demos */ = {
isa = PBXGroup;
children = (
- B282191F12FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.h */,
- B282192012FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.m */,
B2B3CEED1296F78D001BAC94 /* SCSwitchDemoViewController.h */,
B2B3CEEE1296F78D001BAC94 /* SCSwitchDemoViewController.m */,
);
@@ -355,7 +355,7 @@
B257303D1292524F001FC061 /* SCLoadingViewDemoViewController.m in Sources */,
B2B3CEEF1296F78D001BAC94 /* SCSwitchDemoViewController.m in Sources */,
E7FD242712F4FFC5006A6691 /* SCBadgeTableViewCellDemoViewController.m in Sources */,
- B282192112FA7B8800BAF3C6 /* SCRatingPickerDemoViewController.m in Sources */,
+ B28C6D0B12FBE96600667755 /* SSRatingDemoViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
110 SSToolkit.xcodeproj/project.pbxproj
@@ -6,21 +6,6 @@
objectVersion = 45;
objects = {
-/* Begin PBXAggregateTarget section */
- B270BB1012DD8564001678EE /* Documentation */ = {
- isa = PBXAggregateTarget;
- buildConfigurationList = B270BB2012DD85B0001678EE /* Build configuration list for PBXAggregateTarget "Documentation" */;
- buildPhases = (
- B270BB0F12DD8564001678EE /* ShellScript */,
- );
- dependencies = (
- B270BB1412DD8567001678EE /* PBXTargetDependency */,
- );
- name = Documentation;
- productName = Documentation;
- };
-/* End PBXAggregateTarget section */
-
/* Begin PBXBuildFile section */
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
B207C63712EA209100412418 /* SSWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = B207C63512EA209100412418 /* SSWindow.h */; };
@@ -97,6 +82,8 @@
B28218BF12FA6AE100BAF3C6 /* SSToolkitDefines.m in Sources */ = {isa = PBXBuildFile; fileRef = B28218BD12FA6AE100BAF3C6 /* SSToolkitDefines.m */; };
B28219DD12FA8EB500BAF3C6 /* SSRatingPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = B28219DB12FA8EB500BAF3C6 /* SSRatingPicker.h */; };
B28219DE12FA8EB500BAF3C6 /* SSRatingPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = B28219DC12FA8EB500BAF3C6 /* SSRatingPicker.m */; };
+ B28C6D0712FBE5C400667755 /* SSRatingPickerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6D0512FBE5C400667755 /* SSRatingPickerViewController.h */; };
+ B28C6D0812FBE5C400667755 /* SSRatingPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B28C6D0612FBE5C400667755 /* SSRatingPickerViewController.m */; };
B2AAE65C1281B73E0068EE7F /* SSNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AAE65A1281B73E0068EE7F /* SSNavigationController.h */; };
B2AAE65D1281B73E0068EE7F /* SSNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2AAE65B1281B73E0068EE7F /* SSNavigationController.m */; };
B2AE1134126F963300534CF2 /* UIApplication+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AE1132126F963300534CF2 /* UIApplication+SSToolkitAdditions.h */; };
@@ -109,16 +96,6 @@
B2EA9F6312F4A5E100C929D6 /* SSBadgeView.m in Sources */ = {isa = PBXBuildFile; fileRef = B2EA9F6112F4A5E100C929D6 /* SSBadgeView.m */; };
/* End PBXBuildFile section */
-/* Begin PBXContainerItemProxy section */
- B270BB1312DD8567001678EE /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = D2AAC07D0554694100DB518D;
- remoteInfo = SSToolkit;
- };
-/* End PBXContainerItemProxy section */
-
/* Begin PBXFileReference section */
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
B207C63512EA209100412418 /* SSWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSWindow.h; sourceTree = "<group>"; };
@@ -196,6 +173,8 @@
B28218BD12FA6AE100BAF3C6 /* SSToolkitDefines.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSToolkitDefines.m; sourceTree = "<group>"; };
B28219DB12FA8EB500BAF3C6 /* SSRatingPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSRatingPicker.h; sourceTree = "<group>"; };
B28219DC12FA8EB500BAF3C6 /* SSRatingPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSRatingPicker.m; sourceTree = "<group>"; };
+ B28C6D0512FBE5C400667755 /* SSRatingPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSRatingPickerViewController.h; sourceTree = "<group>"; };
+ B28C6D0612FBE5C400667755 /* SSRatingPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSRatingPickerViewController.m; sourceTree = "<group>"; };
B2AAE65A1281B73E0068EE7F /* SSNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSNavigationController.h; sourceTree = "<group>"; };
B2AAE65B1281B73E0068EE7F /* SSNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSNavigationController.m; sourceTree = "<group>"; };
B2AE1132126F963300534CF2 /* UIApplication+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+SSToolkitAdditions.h"; sourceTree = "<group>"; };
@@ -376,6 +355,8 @@
B24E9E27121DC29A0085F81E /* SSModalViewController.h */,
B24E9E28121DC29A0085F81E /* SSPickerViewController.h */,
B24E9E29121DC29A0085F81E /* SSPickerViewController.m */,
+ B28C6D0512FBE5C400667755 /* SSRatingPickerViewController.h */,
+ B28C6D0612FBE5C400667755 /* SSRatingPickerViewController.m */,
B20AC0671267988600687143 /* SSTableViewController.h */,
B20AC0681267988600687143 /* SSTableViewController.m */,
B24E9E31121DC29A0085F81E /* SSViewController.h */,
@@ -471,6 +452,7 @@
B2EA9F6212F4A5E100C929D6 /* SSBadgeView.h in Headers */,
B28218BE12FA6AE100BAF3C6 /* SSToolkitDefines.h in Headers */,
B28219DD12FA8EB500BAF3C6 /* SSRatingPicker.h in Headers */,
+ B28C6D0712FBE5C400667755 /* SSRatingPickerViewController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -518,27 +500,10 @@
projectRoot = "";
targets = (
D2AAC07D0554694100DB518D /* SSToolkit */,
- B270BB1012DD8564001678EE /* Documentation */,
);
};
/* End PBXProject section */
-/* Begin PBXShellScriptBuildPhase section */
- B270BB0F12DD8564001678EE /* ShellScript */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "rake --rakefile Documentation/Rakefile";
- };
-/* End PBXShellScriptBuildPhase section */
-
/* Begin PBXSourcesBuildPhase section */
D2AAC07B0554694100DB518D /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -583,19 +548,12 @@
B2EA9F6312F4A5E100C929D6 /* SSBadgeView.m in Sources */,
B28218BF12FA6AE100BAF3C6 /* SSToolkitDefines.m in Sources */,
B28219DE12FA8EB500BAF3C6 /* SSRatingPicker.m in Sources */,
+ B28C6D0812FBE5C400667755 /* SSRatingPickerViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
-/* Begin PBXTargetDependency section */
- B270BB1412DD8567001678EE /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = D2AAC07D0554694100DB518D /* SSToolkit */;
- targetProxy = B270BB1312DD8567001678EE /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
/* Begin XCBuildConfiguration section */
1DEB921F08733DC00010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
@@ -700,49 +658,6 @@
};
name = Release;
};
- B270BB1112DD8564001678EE /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- COPY_PHASE_STRIP = NO;
- GCC_C_LANGUAGE_STANDARD = c99;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
- GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
- GCC_WARN_MISSING_PARENTHESES = YES;
- GCC_WARN_PROTOTYPE_CONVERSION = YES;
- GCC_WARN_SHADOW = YES;
- GCC_WARN_SIGN_COMPARE = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
- GCC_WARN_UNKNOWN_PRAGMAS = YES;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_LABEL = YES;
- GCC_WARN_UNUSED_VALUE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- OTHER_LDFLAGS = "-all_load";
- PREBINDING = NO;
- PRODUCT_NAME = Documentation;
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- USER_HEADER_SEARCH_PATHS = "../SCFoundation/Sources/** ../SCModel/Sources/** ../SCAPI/Sources/**";
- };
- name = Debug;
- };
- B270BB1212DD8564001678EE /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- PRODUCT_NAME = Documentation;
- ZERO_LINK = NO;
- };
- name = Release;
- };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -764,15 +679,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- B270BB2012DD85B0001678EE /* Build configuration list for PBXAggregateTarget "Documentation" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- B270BB1112DD8564001678EE /* Debug */,
- B270BB1212DD8564001678EE /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
View
27 SSToolkit/SSRatingPickerViewController.h
@@ -0,0 +1,27 @@
+//
+// SSRatingPickerViewController.h
+// SSToolkit
+//
+// Created by Sam Soffes on 2/3/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+@class SSRatingPicker;
+@class SSTextField;
+@class SSTextView;
+
+@interface SSRatingPickerViewController : UIViewController <UITextViewDelegate> {
+
+@private
+
+ UIScrollView *_scrollView;
+ SSRatingPicker *_ratingPicker;
+ SSTextField *_titleTextField;
+ SSTextView *_reviewTextView;
+}
+
+@property (nonatomic, retain) SSRatingPicker *ratingPicker;
+@property (nonatomic, retain) SSTextField *titleTextField;
+@property (nonatomic, retain) SSTextView *reviewTextField;
+
+@end
View
125 SSToolkit/SSRatingPickerViewController.m
@@ -0,0 +1,125 @@
+//
+// SSRatingPickerViewController.m
+// SSToolkit
+//
+// Created by Sam Soffes on 2/3/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import "SSRatingPickerViewController.h"
+#import "SSGradientView.h"
+#import "SSRatingPicker.h"
+#import "SSTextField.h"
+#import "SSTextView.h"
+#import "SSDrawingMacros.h"
+
+@implementation SSRatingPickerViewController
+
+@synthesize ratingPicker = _ratingPicker;
+@synthesize titleTextField = _titleTextField;
+@synthesize reviewTextField = _reviewTextField;
+
+#pragma mark NSObject
+
+- (void)dealloc {
+ [_scrollView release];
+ [_ratingPicker release];
+ [_titleTextField release];
+ [_reviewTextField release];
+ [super dealloc];
+}
+
+
+#pragma mark UIViewController
+
+- (void)loadView {
+ [super loadView];
+
+ self.view.backgroundColor = [UIColor whiteColor];
+
+ UIFont *font = [UIFont systemFontOfSize:17.0f];
+ UIColor *topColor = [UIColor colorWithRed:0.878f green:0.890f blue:0.906f alpha:1.0f];
+ UIColor *lineColor = [UIColor colorWithRed:0.839f green:0.839f blue:0.839f alpha:1.0f];
+
+ _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 190.0f)];
+ _scrollView.backgroundColor = [UIColor whiteColor];
+ _scrollView.contentSize = CGSizeMake(320.0f, 191.0f);
+ [self.view addSubview:_scrollView];
+
+ UIView *top = [[UIView alloc] initWithFrame:CGRectMake(0.0f, -400.0f, 320.0f, 400.0f)];
+ top.backgroundColor = topColor;
+ [_scrollView addSubview:top];
+ [top release];
+
+ SSGradientView *gradientView = [[SSGradientView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)];
+ gradientView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
+ gradientView.topColor = topColor;
+ gradientView.bottomColor = [UIColor colorWithRed:0.961f green:0.965f blue:0.973f alpha:1.0f];
+ gradientView.bottomBorderColor = lineColor;
+ gradientView.hasTopBorder = NO;
+ gradientView.hasBottomBorder = YES;
+ gradientView.showsInsets = NO;
+ [_scrollView addSubview:gradientView];
+
+ SSRatingPicker *picker = [[SSRatingPicker alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)];
+ picker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
+ picker.backgroundColor = [UIColor clearColor];
+ [gradientView addSubview:picker];
+ [picker release];
+ [gradientView release];
+
+ _titleTextField = [[SSTextField alloc] initWithFrame:CGRectMake(0.0f, 48.0f, 320.0f, 42.0f)];
+ _titleTextField.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
+ _titleTextField.font = font;
+ _titleTextField.placeholder = @"Title";
+ _titleTextField.textEdgeInsets = UIEdgeInsetsMake(10.0f, 8.0f, 10.0f, 8.0f);
+ [_scrollView addSubview:_titleTextField];
+
+ UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 90.0f, 320.0f, 1.0f)];
+ line.backgroundColor = lineColor;
+ line.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
+ [_scrollView addSubview:line];
+ [line release];
+
+ _reviewTextView = [[SSTextView alloc] initWithFrame:CGRectMake(0.0f, 91.0f, 320.0f, 99.0f)];
+ _reviewTextView.placeholder = @"Review (Optional)";
+ _reviewTextView.font = font;
+ _reviewTextView.scrollEnabled = NO;
+ _reviewTextView.delegate = self;
+ [_scrollView addSubview:_reviewTextView];
+}
+
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
+ }
+ return YES;
+}
+
+
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+ [_titleTextField becomeFirstResponder];
+}
+
+
+#pragma mark UITextViewDelegate
+
+- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
+ if (range.location == [textView.text length] - 1) {
+ [_scrollView scrollRectToVisible:CGRectMake(0.0f, _scrollView.contentSize.height, 320.0f, 1.0f) animated:YES];
+ }
+
+ return YES;
+}
+
+
+- (void)textViewDidChange:(UITextView *)textView {
+ CGFloat height = [textView sizeThatFits:CGSizeMake(_scrollView.frame.size.width, 2000.0f)].height + 91.0f;
+ height = fmax(height, 191.0f);
+ _scrollView.contentSize = CGSizeMake(320.0f, height);
+ _reviewTextView.frame = CGRectSetHeight(_reviewTextView.frame, height - 91.0f);
+}
+
+@end
View
2  SSToolkit/SSTextView.m
@@ -36,7 +36,7 @@ - (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_textChanged:) name:UITextViewTextDidChangeNotification object:self];
- self.placeholderColor = [UIColor lightGrayColor];
+ self.placeholderColor = [UIColor colorWithWhite:0.702f alpha:1.0f];
_shouldDrawPlaceholder = NO;
}
return self;
View
2  SSToolkit/SSToolkit.h
@@ -39,6 +39,7 @@
#import "SSModalViewController.h"
#import "SSNavigationController.h"
#import "SSPickerViewController.h"
+#import "SSRatingPickerViewController.h"
#import "SSTableViewController.h"
#import "SSViewController.h"
@@ -76,6 +77,7 @@
#import <SSToolkit/SSModalViewController.h>
#import <SSToolkit/SSNavigationController.h>
#import <SSToolkit/SSPickerViewController.h>
+#import <SSToolkit/SSRatingPickerViewController.h>
#import <SSToolkit/SSTableViewController.h>
#import <SSToolkit/SSViewController.h>
View
2  SSToolkit/SSWebView.m
@@ -445,8 +445,6 @@ - (UIScrollView *)scrollView {
return (UIScrollView *)view;
}
}
-
-// NSLog(@"Failed to find UIScrollView for SSWebView");
return nil;
}
Please sign in to comment.
Something went wrong with that request. Please try again.