Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Drop UITextAlignment in favor of NSTextAlignment, convert to ARC, and…

… change minimum iOS version to 6.0.
  • Loading branch information...
commit 9c88c839b71a33178c10fae787ef6fffb4e2e7f0 1 parent 910d828
James Van Metre authored
8 Classes/ELCTextFieldCell.h
View
@@ -32,10 +32,10 @@
@interface ELCTextFieldCell : UITableViewCell <UITextFieldDelegate>
-@property (nonatomic, assign) id<ELCTextFieldDelegate> delegate;
-@property (nonatomic, retain) UILabel *leftLabel;
-@property (nonatomic, retain) ELCInsetTextField *rightTextField;
-@property (nonatomic, retain) NSIndexPath *indexPath;
+@property (nonatomic, weak) id<ELCTextFieldDelegate> delegate;
+@property (nonatomic, strong) UILabel *leftLabel;
+@property (nonatomic, strong) ELCInsetTextField *rightTextField;
+@property (nonatomic, strong) NSIndexPath *indexPath;
@end
17 Classes/ELCTextFieldCell.m
View
@@ -33,17 +33,18 @@ @implementation ELCTextFieldCell
//using auto synthesizers
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
-{
- if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
+{
+ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+ if (self) {
- _leftLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ self.leftLabel = [[UILabel alloc] initWithFrame:CGRectZero];
[_leftLabel setBackgroundColor:[UIColor clearColor]];
[_leftLabel setTextColor:[UIColor colorWithRed:.285 green:.376 blue:.541 alpha:1]];
[_leftLabel setFont:[UIFont fontWithName:@"Helvetica" size:17]];
- [_leftLabel setTextAlignment:UITextAlignmentRight];
+ [_leftLabel setTextAlignment:NSTextAlignmentCenter];
[self addSubview:_leftLabel];
- _rightTextField = [[ELCInsetTextField alloc] initWithFrame:CGRectZero];
+ self.rightTextField = [[ELCInsetTextField alloc] initWithFrame:CGRectZero];
_rightTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[_rightTextField setDelegate:self];
[_rightTextField setFont:[UIFont systemFontOfSize:17]];
@@ -148,16 +149,11 @@ - (void)dealloc
{
_delegate = nil;
[_rightTextField resignFirstResponder];
- [_leftLabel release];
- [_rightTextField release];
- [_indexPath release];
- [super dealloc];
}
@end
#pragma mark - ELCInsetTextFieldCell
-
@implementation ELCInsetTextFieldCell
- (void)setFrame:(CGRect)frame
{
@@ -170,3 +166,4 @@ - (void)layoutSubviews
self.rightTextField.frame = CGRectInset(self.rightTextField.frame, 0, 4);
}
@end
+
4 Classes/ELCTextFieldCellDemoAppDelegate.h
View
@@ -14,8 +14,8 @@
UINavigationController *navigationController;
}
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
+@property (nonatomic, strong) IBOutlet UIWindow *window;
+@property (nonatomic, strong) IBOutlet UINavigationController *navigationController;
@end
5 Classes/ELCTextFieldCellDemoAppDelegate.m
View
@@ -79,11 +79,6 @@ Free up as much memory as possible by purging cached data objects that can be re
}
-- (void)dealloc {
- [navigationController release];
- [window release];
- [super dealloc];
-}
@end
4 Classes/RootViewController.h
View
@@ -15,7 +15,7 @@
NSArray *placeholders;
}
-@property (nonatomic, retain) NSArray *labels;
-@property (nonatomic, retain) NSArray *placeholders;
+@property (nonatomic, strong) NSArray *labels;
+@property (nonatomic, strong) NSArray *placeholders;
@end
5 Classes/RootViewController.m
View
@@ -104,7 +104,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
ELCTextFieldCell *cell = (ELCTextFieldCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[ELCTextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[ELCTextFieldCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
[self configureCell:cell atIndexPath:indexPath];
@@ -209,9 +209,6 @@ - (void)viewDidUnload {
}
-- (void)dealloc {
- [super dealloc];
-}
@end
8 ELCTextFieldCell.podspec
View
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ELCTextFieldCell'
- s.version = '0.1.0'
+ s.version = '0.2.0'
s.summary = 'A UITableViewCell subclass useful for forms.'
s.homepage = 'https://github.com/elc/ELCTextFieldCell'
s.license = {
@@ -9,10 +9,10 @@ Pod::Spec.new do |s|
}
s.author = {'ELC Technologies' => 'http://elctech.com'}
s.source = {:git => 'https://github.com/elc/ELCTextFieldCell.git',
- :tag => '0.1.0'
+ :tag => '0.2.0'
}
- s.platform = :ios, '5.0'
+ s.platform = :ios, '6.0'
s.source_files = 'Classes/ELCTextFieldCell.{h,m}'
s.framework = 'Foundation', 'UIKit'
- s.requires_arc = false
+ s.requires_arc = true
end
10 ELCTextFieldCellDemo.xcodeproj/project.pbxproj
View
@@ -55,10 +55,10 @@
children = (
E26407D512D3A5AF005DA328 /* ELCTextFieldCell.h */,
1A530DCF1672B359008DEBE3 /* ELCTextFieldCell.m */,
- 28C286DF0D94DF7D0034E888 /* RootViewController.h */,
- 28C286E00D94DF7D0034E888 /* RootViewController.m */,
1D3623240D0F684500981E51 /* ELCTextFieldCellDemoAppDelegate.h */,
1D3623250D0F684500981E51 /* ELCTextFieldCellDemoAppDelegate.m */,
+ 28C286DF0D94DF7D0034E888 /* RootViewController.h */,
+ 28C286E00D94DF7D0034E888 /* RootViewController.m */,
);
path = Classes;
sourceTree = "<group>";
@@ -137,6 +137,8 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
+ attributes = {
+ };
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ELCTextFieldCellDemo" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
@@ -188,6 +190,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -202,6 +205,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ELCTextFieldCellDemo_Prefix.pch;
@@ -219,6 +223,7 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
PREBINDING = NO;
SDKROOT = iphoneos;
};
@@ -232,6 +237,7 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos;
8 main.m
View
@@ -10,8 +10,8 @@
int main(int argc, char *argv[]) {
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- int retVal = UIApplicationMain(argc, argv, nil, nil);
- [pool release];
- return retVal;
+ @autoreleasepool {
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ return retVal;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.