Skip to content

Convert to ARC #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions UAModalPanel.xcodeproj/project.pbxproj
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
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 */; };
E65CAB4514CFB9A8004F3776 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E65CAB4114CFB9A8004F3776 /* InfoPlist.strings */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -214,8 +212,8 @@
children = (
E65CAB2E14CFB98C004F3776 /* UAAppDelegate.h */,
E65CAB2F14CFB98C004F3776 /* UAAppDelegate.m */,
E65CAB2414CFB98C004F3776 /* UAViewController.m */,
E65CAB2514CFB98C004F3776 /* UAViewController.h */,
E65CAB2414CFB98C004F3776 /* UAViewController.m */,
E65CAB2114CFB98C004F3776 /* UAExampleModalPanel.m */,
E65CAB2214CFB98C004F3776 /* UAExampleModalPanel.h */,
E65CAB4614CFB9C1004F3776 /* Images */,
Expand Down Expand Up @@ -282,11 +280,9 @@
E65CAB1A14CFB930004F3776 /* close.png in Resources */,
E65CAB1B14CFB930004F3776 /* [email protected] 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 */,
E65CAB4514CFB9A8004F3776 /* InfoPlist.strings in Resources */,
E659BE00158D633F0031B337 /* modalButton.png in Resources */,
E659BE01158D633F0031B337 /* [email protected] in Resources */,
E659BE11158D6AFF0031B337 /* modalButton-selected.png in Resources */,
Expand Down Expand Up @@ -392,6 +388,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 = (
Expand All @@ -411,6 +408,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 = "";
Expand Down
12 changes: 3 additions & 9 deletions UAModalPanel/Example Project/UAAppDelegate.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion UAModalPanel/Example Project/UAExampleModalPanel.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
IBOutlet UIView *viewLoadedFromXib;
}

@property (nonatomic, retain) IBOutlet UIView *viewLoadedFromXib;
@property (nonatomic, strong) IBOutlet UIView *viewLoadedFromXib;

- (id)initWithFrame:(CGRect)frame title:(NSString *)title;
- (IBAction)buttonPressed:(id)sender;
Expand Down
19 changes: 7 additions & 12 deletions UAModalPanel/Example Project/UAExampleModalPanel.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ - (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];

Expand All @@ -96,18 +96,13 @@ - (id)initWithFrame:(CGRect)frame title:(NSString *)title {
NSArray *contentArray = [NSArray arrayWithObjects:wv, tv, iv, viewLoadedFromXib, nil];

int i = arc4random() % [contentArray count];
v = [[contentArray objectAtIndex:i] retain];
v = [contentArray objectAtIndex:i];
[self.contentView addSubview:v];

}
return self;
}

- (void)dealloc {
[v release];
[viewLoadedFromXib release];
[super dealloc];
}

- (void)layoutSubviews {
[super layoutSubviews];
Expand All @@ -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 %d", indexPath.row]];
Expand All @@ -138,8 +133,8 @@ - (IBAction)buttonPressed:(id)sender {
// The button was pressed. Lets do something with it.

// Maybe the delegate wants something to do with it...
if ([delegate respondsToSelector:@selector(superAwesomeButtonPressed:)]) {
[delegate performSelector:@selector(superAwesomeButtonPressed:) withObject:sender];
if ([self.delegate respondsToSelector:@selector(superAwesomeButtonPressed:)]) {
[self.delegate performSelector:@selector(superAwesomeButtonPressed:) withObject:sender];

// Or perhaps someone is listening for notifications
} else {
Expand Down
7 changes: 4 additions & 3 deletions UAModalPanel/Example Project/UAViewController.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,18 +37,19 @@ - (IBAction)showModalPanel:(id)sender {
// The block is responsible for closing the panel,
// either with -[UAModalPanel hide] or -[UAModalPanel hideWithOnComplete:]
// Panel is a reference to the modalPanel
__weak UAExampleModalPanel *weakModalPanel = modalPanel;
modalPanel.onClosePressed = ^(UAModalPanel* panel) {
// [panel hide];
[panel hideWithOnComplete:^(BOOL finished) {
[panel removeFromSuperview];
}];
UADebugLog(@"onClosePressed block called from panel: %@", modalPanel);
UADebugLog(@"onClosePressed block called from panel: %@", weakModalPanel);
};

///////////////////////////////////////////
// Panel is a reference to the modalPanel
modalPanel.onActionPressed = ^(UAModalPanel* panel) {
UADebugLog(@"onActionPressed block called from panel: %@", modalPanel);
UADebugLog(@"onActionPressed block called from panel: %@", weakModalPanel);
};

UADebugLog(@"UAModalView will display using blocks: %@", modalPanel);
Expand Down
2 changes: 1 addition & 1 deletion UAModalPanel/Panel/Categories/UIView+JMNoise.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
54 changes: 18 additions & 36 deletions UAModalPanel/Panel/Panels/UAModalPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,53 +31,35 @@
typedef void (^UAModalDisplayPanelEvent)(UAModalPanel* panel);
typedef void (^UAModalDisplayPanelAnimationComplete)(BOOL finished);

@interface UAModalPanel : UIView {
NSObject<UAModalPanelDelegate> *delegate;

UIView *contentContainer;
UIView *roundedRect;
UIButton *closeButton;
UIButton *actionButton;
UIView *contentView;

CGPoint startEndPoint;

UIEdgeInsets margin;
UIEdgeInsets padding;

UIColor *borderColor;
CGFloat borderWidth;
CGFloat cornerRadius;
UIColor *contentColor;
BOOL shouldBounce;

}
@interface UAModalPanel : UIView

@property (nonatomic, assign) NSObject<UAModalPanelDelegate> *delegate;
@property (nonatomic, unsafe_unretained) 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;
@property (nonatomic) 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;
@property (nonatomic) 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;
@property (nonatomic) CGFloat borderWidth;
// Corner radius of the panel. Default = 4.0f
@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic) 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;
@property (nonatomic) BOOL shouldBounce;

@property (readwrite, copy) UAModalDisplayPanelEvent onClosePressed;
@property (readwrite, copy) UAModalDisplayPanelEvent onActionPressed;
@property (nonatomic) CGPoint startEndPoint;

@property (readwrite, copy) UAModalDisplayPanelEvent onClosePressed;
@property (readwrite, copy) UAModalDisplayPanelEvent onActionPressed;

- (void)show;
- (void)showFromPoint:(CGPoint)point;
Expand Down
Loading