Skip to content

Commit

Permalink
Convert to ARC.
Browse files Browse the repository at this point in the history
  • Loading branch information
samvermette committed Apr 24, 2012
1 parent ab629a0 commit 1762fce
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Demo/Classes/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
ViewController *viewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ViewController *viewController;
@property (nonatomic) IBOutlet UIWindow *window;
@property (nonatomic) IBOutlet ViewController *viewController;

@end

5 changes: 0 additions & 5 deletions Demo/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}


@end
4 changes: 4 additions & 0 deletions Demo/SVProgressHUD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,13 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = SVProgressHUD_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "SVProgressHUD-Info.plist";
OTHER_CFLAGS = "-DSVPROGRESSHUD_DISABLE_NETWORK_INDICATOR";
PRODUCT_NAME = SVProgressHUD;
Expand All @@ -238,9 +240,11 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = SVProgressHUD_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "SVProgressHUD-Info.plist";
PRODUCT_NAME = SVProgressHUD;
SDKROOT = iphoneos;
Expand Down
8 changes: 4 additions & 4 deletions Demo/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 1 addition & 7 deletions README.textile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
__29/02 IMPORTANT CHANGE: SVProgressHUD no longer interacts with iOS's status bar network activity indicator. Dedicated methods have been deprecated and you will need to show/hide the activity indicator yourself (ideally from a controller or the "class that makes the network requests":https://github.com/samvermette/SVHTTPRequest).__

h1. SVProgressHUD
__Note: SVProgressHUD now uses Automatic Reference Counting (ARC). Find the last MRC commit on the "last-mrc":https://github.com/samvermette/SVProgressHUD/tree/last-mrc branch.__

SVProgressHUD is an easy-to-use, clean and lightweight progress HUD for iOS. It's a simplified and prettified alternative to the popular "MBProgressHUD":https://github.com/jdg/MBProgressHUD. Its fade in/out animations are highly inspired on Lauren Britcher's HUD in Tweetie for iOS. The success and error icons are from "Glyphish":http://glyphish.com/.

Expand Down Expand Up @@ -69,10 +67,6 @@ enum {
};
</pre>

h2. Automatic Reference Counting (ARC) support

Maintaining an official ARC branch has proven to be too much work, often leading to confusion since the ARC branch is always a few commits behind. If you'd like to use SVProgressHUD in your ARC-enabled project, you'll have to "add the @-fno-objc-arc@ compiler flag":http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project to all of SVProgressHUD's files.

h2. Credits

SVProgressHUD is brought to you by "Sam Vermette":http://samvermette.com and "contributors to the project":https://github.com/samvermette/SVProgressHUD/contributors. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by "creating new issues":https://github.com/samvermette/SVProgressHUD/issues/new. If you're using SVProgressHUD in your project, attribution would be nice.
27 changes: 7 additions & 20 deletions SVProgressHUD/SVProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ @interface SVProgressHUD ()

@property (nonatomic, readwrite) SVProgressHUDMaskType maskType;
@property (nonatomic, readwrite) BOOL showNetworkIndicator;
@property (nonatomic, retain) NSTimer *fadeOutTimer;
@property (nonatomic) NSTimer *fadeOutTimer;

@property (nonatomic, readonly) UIWindow *overlayWindow;
@property (nonatomic, readonly) UIView *hudView;
Expand Down Expand Up @@ -42,16 +42,8 @@ @implementation SVProgressHUD
@synthesize overlayWindow, hudView, maskType, showNetworkIndicator, fadeOutTimer, stringLabel, imageView, spinnerView, visibleKeyboardHeight;

- (void)dealloc {

self.fadeOutTimer = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];

[hudView release];
[stringLabel release];
[imageView release];
[spinnerView release];

[super dealloc];
}


Expand Down Expand Up @@ -230,10 +222,10 @@ - (void)setStatus:(NSString *)string {
- (void)setFadeOutTimer:(NSTimer *)newTimer {

if(fadeOutTimer)
[fadeOutTimer invalidate], [fadeOutTimer release], fadeOutTimer = nil;
[fadeOutTimer invalidate], fadeOutTimer = nil;

if(newTimer)
fadeOutTimer = [newTimer retain];
fadeOutTimer = newTimer;
}


Expand Down Expand Up @@ -449,9 +441,8 @@ - (void)dismiss {
completion:^(BOOL finished){
if(self.alpha == 0) {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[overlayWindow release], overlayWindow = nil;
[hudView removeFromSuperview];
[hudView release], hudView = nil;
[hudView removeFromSuperview], hudView = nil;
overlayWindow = nil;

// find the frontmost window that is an actual UIWindow and make it keyVisible
[[UIApplication sharedApplication].windows enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(UIWindow *window, NSUInteger idx, BOOL *stop) {
Expand Down Expand Up @@ -545,9 +536,7 @@ - (UIActivityIndicatorView *)spinnerView {
}

- (CGFloat)visibleKeyboardHeight {

NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc] init];


UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
if(![[testWindow class] isEqual:[UIWindow class]]) {
Expand All @@ -558,7 +547,7 @@ - (CGFloat)visibleKeyboardHeight {

// Locate UIKeyboard.
UIView *foundKeyboard = nil;
for (UIView *possibleKeyboard in [keyboardWindow subviews]) {
for (__strong UIView *possibleKeyboard in [keyboardWindow subviews]) {

// iOS 4 sticks the UIKeyboard inside a UIPeripheralHostView.
if ([[possibleKeyboard description] hasPrefix:@"<UIPeripheralHostView"]) {
Expand All @@ -570,8 +559,6 @@ - (CGFloat)visibleKeyboardHeight {
break;
}
}

[autoreleasePool release];

if(foundKeyboard && foundKeyboard.bounds.size.height > 100)
return foundKeyboard.bounds.size.height;
Expand Down

0 comments on commit 1762fce

Please sign in to comment.