Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #38 from kambala-decapitator/master

add ARC support & update project to modern standards
  • Loading branch information...
commit a068c641133bf776aaed0d6deb80a2e35fa6bb89 2 parents 7a201c0 + 1f75c35
@coneybeare coneybeare authored
View
33 UAModalPanel.xcodeproj/project.pbxproj
@@ -28,7 +28,6 @@
E65CAB3514CFB98C004F3776 /* UAViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E65CAB2414CFB98C004F3776 /* UAViewController.m */; };
E65CAB3614CFB98C004F3776 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E65CAB2614CFB98C004F3776 /* main.m */; };
E65CAB3A14CFB98C004F3776 /* UAAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E65CAB2F14CFB98C004F3776 /* UAAppDelegate.m */; };
- E65CAB3B14CFB98C004F3776 /* UAModalPanel-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E65CAB3014CFB98C004F3776 /* UAModalPanel-Info.plist */; };
E65CAB3C14CFB98C004F3776 /* UrbanApps.png in Resources */ = {isa = PBXBuildFile; fileRef = E65CAB3214CFB98C004F3776 /* UrbanApps.png */; };
E65CAB4314CFB9A8004F3776 /* UAViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = E65CAB3D14CFB9A8004F3776 /* UAViewController_iPhone.xib */; };
E65CAB4414CFB9A8004F3776 /* UAViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = E65CAB3F14CFB9A8004F3776 /* UAViewController_iPad.xib */; };
@@ -254,7 +253,7 @@
E64F51F814BA98FA009CB18D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0420;
+ LastUpgradeCheck = 0610;
ORGANIZATIONNAME = "Urban Apps";
};
buildConfigurationList = E64F51FB14BA98FA009CB18D /* Build configuration list for PBXProject "UAModalPanel" */;
@@ -282,7 +281,6 @@
E65CAB1A14CFB930004F3776 /* close.png in Resources */,
E65CAB1B14CFB930004F3776 /* close@2x.png in Resources */,
E65CAB3414CFB98C004F3776 /* UAExampleView.xib in Resources */,
- E65CAB3B14CFB98C004F3776 /* UAModalPanel-Info.plist in Resources */,
E65CAB3C14CFB98C004F3776 /* UrbanApps.png in Resources */,
E65CAB4314CFB9A8004F3776 /* UAViewController_iPhone.xib in Resources */,
E65CAB4414CFB9A8004F3776 /* UAViewController_iPad.xib in Resources */,
@@ -348,9 +346,16 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -360,10 +365,15 @@
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
@@ -373,13 +383,24 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
@@ -392,6 +413,7 @@
E64F522314BA98FA009CB18D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UAModalPanel/Example Project/UAModalPanel-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -411,6 +433,7 @@
E64F522414BA98FA009CB18D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UAModalPanel/Example Project/UAModalPanel-Prefix.pch";
GCC_VERSION = "";
View
12 UAModalPanel/Example Project/UAAppDelegate.m
@@ -15,21 +15,15 @@ @implementation UAAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
-- (void)dealloc
-{
- [_window release];
- [_viewController release];
- [super dealloc];
-}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
- self.viewController = [[[UAViewController alloc] initWithNibName:@"UAViewController_iPhone" bundle:nil] autorelease];
+ self.viewController = [[UAViewController alloc] initWithNibName:@"UAViewController_iPhone" bundle:nil];
} else {
- self.viewController = [[[UAViewController alloc] initWithNibName:@"UAViewController_iPad" bundle:nil] autorelease];
+ self.viewController = [[UAViewController alloc] initWithNibName:@"UAViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
View
4 UAModalPanel/Example Project/UAExampleModalPanel.h
@@ -13,9 +13,9 @@
IBOutlet UIView *viewLoadedFromXib;
}
-@property (nonatomic, retain) IBOutlet UIView *viewLoadedFromXib;
+@property (nonatomic, strong) IBOutlet UIView *viewLoadedFromXib;
-- (id)initWithFrame:(CGRect)frame title:(NSString *)title;
+- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title NS_DESIGNATED_INITIALIZER;
- (IBAction)buttonPressed:(id)sender;
@end
View
19 UAModalPanel/Example Project/UAExampleModalPanel.m
@@ -14,7 +14,7 @@ @implementation UAExampleModalPanel
@synthesize viewLoadedFromXib;
-- (id)initWithFrame:(CGRect)frame title:(NSString *)title {
+- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title {
if ((self = [super initWithFrame:frame])) {
CGFloat colors[8] = BLACK_BAR_COMPONENTS;
@@ -81,33 +81,28 @@ - (id)initWithFrame:(CGRect)frame title:(NSString *)title {
//////////////////////////////////////
// SETUP RANDOM CONTENT
//////////////////////////////////////
- UIWebView *wv = [[[UIWebView alloc] initWithFrame:CGRectZero] autorelease];
+ UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectZero];
[wv loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://urbanapps.com/product_list"]]];
- UITableView *tv = [[[UITableView alloc] initWithFrame:CGRectZero] autorelease];
+ UITableView *tv = [[UITableView alloc] initWithFrame:CGRectZero];
[tv setDataSource:self];
- UIImageView *iv = [[[UIImageView alloc] initWithFrame:CGRectZero] autorelease];
+ UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectZero];
[iv setImage:[UIImage imageNamed:@"UrbanApps.png"]];
[iv setContentMode:UIViewContentModeScaleAspectFit];
[[NSBundle mainBundle] loadNibNamed:@"UAExampleView" owner:self options:nil];
- NSArray *contentArray = [NSArray arrayWithObjects:wv, tv, iv, viewLoadedFromXib, nil];
+ NSArray *contentArray = @[wv, tv, iv, viewLoadedFromXib];
int i = arc4random() % [contentArray count];
- v = [[contentArray objectAtIndex:i] retain];
+ v = contentArray[i];
[self.contentView addSubview:v];
}
return self;
}
-- (void)dealloc {
- [v release];
- [viewLoadedFromXib release];
- [super dealloc];
-}
- (void)layoutSubviews {
[super layoutSubviews];
@@ -125,7 +120,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
NSString *cellIdentifier = @"UAModalPanelCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
[cell.textLabel setText:[NSString stringWithFormat:@"Row %ld", (long)indexPath.row]];
View
6 UAModalPanel/Example Project/UAViewController.m
@@ -23,7 +23,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (IBAction)showModalPanel:(id)sender {
- UAExampleModalPanel *modalPanel = [[[UAExampleModalPanel alloc] initWithFrame:self.view.bounds title:[(UIButton *)sender titleForState:UIControlStateNormal]] autorelease];
+ UAExampleModalPanel *modalPanel = [[UAExampleModalPanel alloc] initWithFrame:self.view.bounds title:[(UIButton *)sender titleForState:UIControlStateNormal]];
/////////////////////////////////
// Randomly use the blocks method, delgate methods, or neither of them
@@ -42,13 +42,13 @@ - (IBAction)showModalPanel:(id)sender {
[panel hideWithOnComplete:^(BOOL finished) {
[panel removeFromSuperview];
}];
- UADebugLog(@"onClosePressed block called from panel: %@", modalPanel);
+ UADebugLog(@"onClosePressed block called from panel: %@", panel);
};
///////////////////////////////////////////
// Panel is a reference to the modalPanel
modalPanel.onActionPressed = ^(UAModalPanel* panel) {
- UADebugLog(@"onActionPressed block called from panel: %@", modalPanel);
+ UADebugLog(@"onActionPressed block called from panel: %@", panel);
};
UADebugLog(@"UAModalView will display using blocks: %@", modalPanel);
View
2  UAModalPanel/Panel/Categories/UIView+JMNoise.m
@@ -99,7 +99,7 @@ - (void)applyNoise;
- (void)applyNoiseWithOpacity:(CGFloat)opacity atLayerIndex:(NSUInteger) layerIndex;
{
- NoiseLayer * noiseLayer = [[[NoiseLayer alloc] init] autorelease];
+ NoiseLayer * noiseLayer = [[NoiseLayer alloc] init];
[noiseLayer setFrame:self.bounds];
noiseLayer.masksToBounds = YES;
noiseLayer.opacity = opacity;
View
24 UAModalPanel/Panel/Panels/UAModalPanel.h
@@ -32,7 +32,7 @@ typedef void (^UAModalDisplayPanelEvent)(UAModalPanel* panel);
typedef void (^UAModalDisplayPanelAnimationComplete)(BOOL finished);
@interface UAModalPanel : UIView {
- NSObject<UAModalPanelDelegate> *delegate;
+ NSObject<UAModalPanelDelegate> *__weak delegate;
UIView *contentContainer;
UIView *roundedRect;
@@ -53,26 +53,26 @@ typedef void (^UAModalDisplayPanelAnimationComplete)(BOOL finished);
}
-@property (nonatomic, assign) NSObject<UAModalPanelDelegate> *delegate;
+@property (nonatomic, weak) NSObject<UAModalPanelDelegate> *delegate;
-@property (nonatomic, retain) UIView *contentContainer;
-@property (nonatomic, retain) UIView *roundedRect;
-@property (nonatomic, retain) UIButton *closeButton;
-@property (nonatomic, retain) UIButton *actionButton;
-@property (nonatomic, retain) UIView *contentView;
+@property (nonatomic, strong) UIView *contentContainer;
+@property (nonatomic, strong) UIView *roundedRect;
+@property (nonatomic, strong) UIButton *closeButton;
+@property (nonatomic, strong) UIButton *actionButton;
+@property (nonatomic, strong) UIView *contentView;
// Margin between edge of container frame and panel. Default = {20.0, 20.0, 20.0, 20.0}
@property (nonatomic, assign) UIEdgeInsets margin;
// Padding between edge of panel and the content area. Default = {20.0, 20.0, 20.0, 20.0}
@property (nonatomic, assign) UIEdgeInsets padding;
// Border color of the panel. Default = [UIColor whiteColor]
-@property (nonatomic, retain) UIColor *borderColor;
+@property (nonatomic, strong) UIColor *borderColor;
// Border width of the panel. Default = 1.5f
@property (nonatomic, assign) CGFloat borderWidth;
// Corner radius of the panel. Default = 4.0f
@property (nonatomic, assign) CGFloat cornerRadius;
// Color of the panel itself. Default = [UIColor colorWithWhite:0.0 alpha:0.8]
-@property (nonatomic, retain) UIColor *contentColor;
+@property (nonatomic, strong) UIColor *contentColor;
// Shows the bounce animation. Default = YES
@property (nonatomic, assign) BOOL shouldBounce;
@@ -84,8 +84,8 @@ typedef void (^UAModalDisplayPanelAnimationComplete)(BOOL finished);
- (void)hide;
- (void)hideWithOnComplete:(UAModalDisplayPanelAnimationComplete)onComplete;
-- (CGRect)roundedRectFrame;
-- (CGRect)closeButtonFrame;
-- (CGRect)contentViewFrame;
+@property (NS_NONATOMIC_IOSONLY, readonly) CGRect roundedRectFrame;
+@property (NS_NONATOMIC_IOSONLY, readonly) CGRect closeButtonFrame;
+@property (NS_NONATOMIC_IOSONLY, readonly) CGRect contentViewFrame;
@end
View
29 UAModalPanel/Panel/Panels/UAModalPanel.m
@@ -26,7 +26,7 @@ @implementation UAModalPanel
@synthesize onClosePressed, onActionPressed;
-- (id)initWithFrame:(CGRect)frame {
+- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self != nil) {
delegate = nil;
@@ -40,14 +40,14 @@ - (id)initWithFrame:(CGRect)frame {
padding = UIEdgeInsetsMake(DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN, DEFAULT_MARGIN);
cornerRadius = DEFAULT_CORNER_RADIUS;
borderWidth = DEFAULT_BORDER_WIDTH;
- borderColor = [DEFAULT_BORDER_COLOR retain];
- contentColor = [DEFAULT_BACKGROUND_COLOR retain];
+ borderColor = DEFAULT_BORDER_COLOR;
+ contentColor = DEFAULT_BACKGROUND_COLOR;
shouldBounce = DEFAULT_BOUNCE;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.autoresizesSubviews = YES;
- self.contentContainer = [[[UIView alloc] initWithFrame:self.bounds] autorelease];
+ self.contentContainer = [[UIView alloc] initWithFrame:self.bounds];
self.contentContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.contentContainer.autoresizesSubviews = YES;
[self addSubview:self.contentContainer];
@@ -63,19 +63,6 @@ - (id)initWithFrame:(CGRect)frame {
return self;
}
-- (void)dealloc {
- self.roundedRect = nil;
- self.closeButton = nil;
- self.actionButton = nil;
- self.contentContainer = nil;
- self.borderColor = nil;
- self.contentColor = nil;
- self.onActionPressed = nil;
- self.onClosePressed = nil;
- self.delegate = nil;
- [super dealloc];
-}
-
#pragma mark - Description
- (NSString *)description {
@@ -93,15 +80,11 @@ - (void)setBorderWidth:(CGFloat)newWidth {
self.roundedRect.layer.borderWidth = borderWidth;
}
- (void)setBorderColor:(UIColor *)newColor {
- [newColor retain];
- [borderColor release];
borderColor = newColor;
self.roundedRect.layer.borderColor = [borderColor CGColor];
}
- (void)setContentColor:(UIColor *)newColor {
- [newColor retain];
- [contentColor release];
contentColor = newColor;
self.roundedRect.backgroundColor = contentColor;
@@ -109,7 +92,7 @@ - (void)setContentColor:(UIColor *)newColor {
- (UIView *)roundedRect {
if (!roundedRect) {
- self.roundedRect = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+ self.roundedRect = [[UIView alloc] initWithFrame:CGRectZero];
self.roundedRect.layer.masksToBounds = YES;
self.roundedRect.backgroundColor = self.contentColor;
self.roundedRect.layer.borderColor = [self.borderColor CGColor];
@@ -164,7 +147,7 @@ - (UIButton*)actionButton {
- (UIView *)contentView {
if (!contentView) {
- self.contentView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+ self.contentView = [[UIView alloc] initWithFrame:CGRectZero];
self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.contentView.autoresizesSubviews = YES;
[self.contentContainer insertSubview:contentView aboveSubview:self.roundedRect];
View
6 UAModalPanel/Panel/Panels/UATitledModalPanel.h
@@ -21,10 +21,10 @@
// Height of the title view. Default = 40.0f
@property (nonatomic, assign) CGFloat titleBarHeight;
// The gradient bacground of the title
-@property (nonatomic, retain) UANoisyGradientBackground *titleBar;
+@property (nonatomic, strong) UANoisyGradientBackground *titleBar;
// The title label
-@property (nonatomic, retain) UILabel *headerLabel;
+@property (nonatomic, strong) UILabel *headerLabel;
-- (CGRect)titleBarFrame;
+@property (NS_NONATOMIC_IOSONLY, readonly) CGRect titleBarFrame;
@end
View
9 UAModalPanel/Panel/Panels/UATitledModalPanel.m
@@ -21,13 +21,8 @@ @implementation UATitledModalPanel
@synthesize titleBarHeight, titleBar, headerLabel;
-- (void)dealloc {
- self.titleBar = nil;
- self.headerLabel = nil;
- [super dealloc];
-}
-- (id)initWithFrame:(CGRect)frame {
+- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
@@ -43,7 +38,7 @@ - (id)initWithFrame:(CGRect)frame {
[self.roundedRect addSubview:self.titleBar];
- self.headerLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
+ self.headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.headerLabel.font = [UIFont systemFontOfSize:24];
self.headerLabel.backgroundColor = [UIColor clearColor];
self.headerLabel.textColor = [UIColor whiteColor];
View
16 UAModalPanel/Panel/Views/UAGradientBackground.h
@@ -8,20 +8,20 @@
#import <UIKit/UIKit.h>
-typedef enum {
+typedef NS_ENUM(NSInteger, UAGradientBackgroundStyle) {
UAGradientBackgroundStyleRadial = 0,
UAGradientBackgroundStyleRadialReversed,
UAGradientBackgroundStyleLinear,
UAGradientBackgroundStyleLinearReversed,
UAGradientBackgroundStyleCenterHighlight,
-} UAGradientBackgroundStyle;
+} ;
-typedef enum {
+typedef NS_OPTIONS(NSUInteger, UAGradientLineMode) {
UAGradientLineModeNone = 0,
UAGradientLineModeTop = 2,
UAGradientLineModeBottom = 4,
UAGradientLineModeTopAndBottom = 8
-} UAGradientLineMode;
+} ;
@interface UAGradientBackground : UIView {
UAGradientBackgroundStyle gradientStyle;
@@ -32,10 +32,10 @@ typedef enum {
@property (nonatomic, assign) UAGradientBackgroundStyle gradientStyle;
@property (nonatomic, assign) UAGradientLineMode lineMode;
-- (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes;
-- (id)initWithFrame:(CGRect)frame color:(CGFloat *)components;
-- (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle;
-- (id)initWithFrame:(CGRect)frame;
+- (instancetype)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithFrame:(CGRect)frame color:(CGFloat *)components;
+- (instancetype)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle;
+- (instancetype)initWithFrame:(CGRect)frame;
- (void)setColorComponents:(CGFloat *)components;
View
17 UAModalPanel/Panel/Views/UAGradientBackground.m
@@ -12,7 +12,7 @@ @implementation UAGradientBackground
@synthesize gradientStyle, lineMode;
-- (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes {
+- (instancetype)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes {
if ((self = [super initWithFrame:frame])) {
// Initialization code
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
@@ -28,30 +28,30 @@ - (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:
}
return self;
}
-- (id)initWithFrame:(CGRect)frame color:(CGFloat *)components {
+- (instancetype)initWithFrame:(CGRect)frame color:(CGFloat *)components {
return [self initWithFrame:frame style:UAGradientBackgroundStyleLinear color:components lineMode:NO];
}
-- (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle {
+- (instancetype)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle {
CGFloat components[8] = { 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0 };
return [self initWithFrame:frame style:aStyle color:components lineMode:UAGradientLineModeNone];
}
-- (id)initWithFrame:(CGRect)frame {
+- (instancetype)initWithFrame:(CGRect)frame {
return [self initWithFrame:frame style:UAGradientBackgroundStyleLinear];
}
+ (id)gradientWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes {
- return [[[UAGradientBackground alloc] initWithFrame:frame style:aStyle color:components lineMode:lineModes] autorelease];
+ return [[UAGradientBackground alloc] initWithFrame:frame style:aStyle color:components lineMode:lineModes];
}
+ (id)gradientWithFrame:(CGRect)frame color:(CGFloat *)components {
- return [[(UAGradientBackground *)[UAGradientBackground alloc] initWithFrame:frame color:components] autorelease];
+ return [(UAGradientBackground *)[UAGradientBackground alloc] initWithFrame:frame color:components];
}
+ (id)gradientWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle {
- return [[[UAGradientBackground alloc] initWithFrame:frame style:aStyle] autorelease];
+ return [[UAGradientBackground alloc] initWithFrame:frame style:aStyle];
}
+ (id)gradientWithFrame:(CGRect)frame; {
- return [[[UAGradientBackground alloc] initWithFrame:frame] autorelease];
+ return [[UAGradientBackground alloc] initWithFrame:frame];
}
@@ -133,7 +133,6 @@ - (void)drawRect:(CGRect)rect {
- (void)dealloc {
NSZoneFree(NSDefaultMallocZone(), colorComponents);
- [super dealloc];
}
View
6 UAModalPanel/Panel/Views/UANoisyGradientBackground.h
@@ -17,9 +17,9 @@
@property (nonatomic, assign) CGFloat noiseOpacity;
@property (nonatomic, assign) CGBlendMode blendMode;
-- (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes noiseOpacity:(CGFloat)opacity blendMode:(CGBlendMode)mode;
-- (id)initWithFrame:(CGRect)frame noiseOpacity:(CGFloat)opacity;
-- (id)initWithFrame:(CGRect)frame blendMode:(CGFloat)mode;
+- (instancetype)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes noiseOpacity:(CGFloat)opacity blendMode:(CGBlendMode)mode;
+- (instancetype)initWithFrame:(CGRect)frame noiseOpacity:(CGFloat)opacity;
+- (instancetype)initWithFrame:(CGRect)frame blendMode:(CGFloat)mode;
+ (id)gradientWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes noiseOpacity:(CGFloat)opacity blendMode:(CGBlendMode)mode;
+ (id)gradientWithFrame:(CGRect)frame noiseOpacity:(CGFloat)opacity;
View
16 UAModalPanel/Panel/Views/UANoisyGradientBackground.m
@@ -18,27 +18,27 @@ @implementation UANoisyGradientBackground
@synthesize noiseOpacity, blendMode;
-- (id)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes noiseOpacity:(CGFloat)opacity blendMode:(CGBlendMode)mode {
+- (instancetype)initWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes noiseOpacity:(CGFloat)opacity blendMode:(CGBlendMode)mode {
if ((self = [self initWithFrame:frame style:aStyle color:components lineMode:lineModes])) {
self.noiseOpacity = opacity;
self.blendMode = mode;
}
return self;
}
-- (id)initWithFrame:(CGRect)frame noiseOpacity:(CGFloat)opacity {
+- (instancetype)initWithFrame:(CGRect)frame noiseOpacity:(CGFloat)opacity {
if (self = [self initWithFrame:frame]) {
self.noiseOpacity = opacity;
}
return self;
}
-- (id)initWithFrame:(CGRect)frame blendMode:(CGFloat)mode {
+- (instancetype)initWithFrame:(CGRect)frame blendMode:(CGFloat)mode {
if ((self = [self initWithFrame:frame])) {
self.blendMode = blendMode;
}
return self;
}
-- (id)initWithFrame:(CGRect)frame {
+- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.noiseOpacity = NOISE_DEFAULT_OPACITY;
@@ -50,18 +50,18 @@ - (id)initWithFrame:(CGRect)frame {
+ (id)gradientWithFrame:(CGRect)frame style:(UAGradientBackgroundStyle)aStyle color:(CGFloat *)components lineMode:(UAGradientLineMode)lineModes noiseOpacity:(CGFloat)opacity blendMode:(CGBlendMode)mode {
- return [[[UANoisyGradientBackground alloc] initWithFrame:frame
+ return [[UANoisyGradientBackground alloc] initWithFrame:frame
style:aStyle
color:components
lineMode:lineModes
noiseOpacity:opacity
- blendMode:mode] autorelease];
+ blendMode:mode];
}
+ (id)gradientWithFrame:(CGRect)frame noiseOpacity:(CGFloat)noiseOpacity {
- return [[[UANoisyGradientBackground alloc] initWithFrame:frame noiseOpacity:noiseOpacity] autorelease];
+ return [[UANoisyGradientBackground alloc] initWithFrame:frame noiseOpacity:noiseOpacity];
}
+ (id)gradientWithFrame:(CGRect)frame blendMode:(CGFloat)mode {
- return [[[UANoisyGradientBackground alloc] initWithFrame:frame blendMode:mode] autorelease];
+ return [[UANoisyGradientBackground alloc] initWithFrame:frame blendMode:mode];
}
View
9 UAModalPanel/Panel/Views/UARoundedRectView.m
@@ -16,7 +16,7 @@ @implementation UARoundedRectView
+ (Class)layerClass {
return [CAGradientLayer class];
}
-- (id)initWithFrame:(CGRect)frame {
+- (instancetype)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.backgroundColor = [UIColor clearColor];
@@ -35,10 +35,8 @@ - (void)setColors:(CGFloat *)components {
CAGradientLayer *gradientLayer = (CAGradientLayer *)self.layer;
gradientLayer.colors =
- [NSArray arrayWithObjects:
- (id)[UIColor colorWithRed:colorComponents[0] green:colorComponents[1] blue:colorComponents[2] alpha:colorComponents[3]].CGColor,
- (id)[UIColor colorWithRed:colorComponents[4] green:colorComponents[5] blue:colorComponents[6] alpha:colorComponents[7]].CGColor,
- nil];
+ @[(id)[UIColor colorWithRed:colorComponents[0] green:colorComponents[1] blue:colorComponents[2] alpha:colorComponents[3]].CGColor,
+ (id)[UIColor colorWithRed:colorComponents[4] green:colorComponents[5] blue:colorComponents[6] alpha:colorComponents[7]].CGColor];
}
@@ -50,7 +48,6 @@ - (void)setRadius:(NSInteger)rad {
- (void)dealloc {
NSZoneFree(NSDefaultMallocZone(), colorComponents);
- [super dealloc];
}
Please sign in to comment.
Something went wrong with that request. Please try again.