diff --git a/.gitignore b/.gitignore
index 8ebc036..476fda7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@ build
xcuserdata
VolumeSnap.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+
+*.xccheckout
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..fc23efc
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,12 @@
+
+language: objective-c
+
+before_install:
+ - gem install cocoapods --pre --quiet
+ - pod --version
+ - pod setup --silent
+ - pod repo update --silent
+
+script:
+ - pod lib lint RBVolumeButtons@PTEz.podspec
+ - xctool -project 'VolumeSnap.xcodeproj' -scheme 'VolumeSnap' -configuration Release -sdk iphonesimulator -arch i386 build
diff --git a/RBVolumeButtons.podspec b/RBVolumeButtons.podspec
new file mode 100644
index 0000000..a771887
--- /dev/null
+++ b/RBVolumeButtons.podspec
@@ -0,0 +1,33 @@
+
+Pod::Spec.new do |s|
+
+ s.name = "RBVolumeButtons"
+ s.version = "0.0.1"
+ s.summary = "This lets you steal the volume up and volume down buttons on iOS."
+ s.homepage = "https://github.com/blladnar/RBVolumeButtons"
+
+ s.license = { :type => 'Apache License, Version 2.0', :text => <<-LICENSE
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ LICENSE
+ }
+ s.author = { "Randall Brown" => "" }
+
+ s.platform = :ios
+ s.requires_arc = false
+
+ s.source = { :git => "https://github.com/blladnar/RBVolumeButtons.git", :commit => "5ac61f7ddcdfb35e5a8d6844617c9b9f2011587f" }
+ s.source_files = 'VolumeSnap/RBVolumeButtons.{h,m}'
+
+ s.frameworks = 'AudioToolbox', 'MediaPlayer'
+
+end
diff --git a/RBVolumeButtons@PTEz.podspec b/RBVolumeButtons@PTEz.podspec
new file mode 100644
index 0000000..3ef9872
--- /dev/null
+++ b/RBVolumeButtons@PTEz.podspec
@@ -0,0 +1,33 @@
+
+Pod::Spec.new do |s|
+
+ s.name = "RBVolumeButtons@PTEz"
+ s.version = "0.1.1"
+ s.summary = "This lets you steal the volume up and volume down buttons on iOS."
+ s.homepage = "https://github.com/PTEz/RBVolumeButtons"
+
+ s.license = { :type => 'Apache License, Version 2.0', :text => <<-LICENSE
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ LICENSE
+ }
+ s.author = { "Ernesto Rivera" => "rivera.ernesto@gmail.com", "Randall Brown" => "" }
+
+ s.platform = :ios
+ s.requires_arc = true
+
+ s.source = { :git => "https://github.com/PTEz/RBVolumeButtons.git", :tag => "#{s.version}" }
+ s.source_files = 'VolumeSnap/RBVolumeButtons.{h,m}'
+
+ s.frameworks = 'AudioToolbox', 'MediaPlayer'
+
+end
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b8967e5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+RBVolumeButtons
+===============
+
+This lets you steal the volume up and volume down buttons on iOS.
+
+
+ARC version
diff --git a/VolumeSnap.xcodeproj/project.pbxproj b/VolumeSnap.xcodeproj/project.pbxproj
index f3db87a..07f410b 100644
--- a/VolumeSnap.xcodeproj/project.pbxproj
+++ b/VolumeSnap.xcodeproj/project.pbxproj
@@ -62,9 +62,6 @@
70C2EB311475EF4F00751AE8 = {
isa = PBXGroup;
children = (
- 70C2EB611475FE4900751AE8 /* MediaPlayer.framework */,
- 70C2EB5F1475F07400751AE8 /* AudioToolbox.framework */,
- 70C2EB5D1475F03B00751AE8 /* CoreAudio.framework */,
70C2EB461475EF4F00751AE8 /* VolumeSnap */,
70C2EB3F1475EF4F00751AE8 /* Frameworks */,
70C2EB3D1475EF4F00751AE8 /* Products */,
@@ -82,6 +79,9 @@
70C2EB3F1475EF4F00751AE8 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 70C2EB5F1475F07400751AE8 /* AudioToolbox.framework */,
+ 70C2EB611475FE4900751AE8 /* MediaPlayer.framework */,
+ 70C2EB5D1475F03B00751AE8 /* CoreAudio.framework */,
70C2EB401475EF4F00751AE8 /* UIKit.framework */,
70C2EB421475EF4F00751AE8 /* Foundation.framework */,
70C2EB441475EF4F00751AE8 /* CoreGraphics.framework */,
@@ -142,7 +142,7 @@
70C2EB331475EF4F00751AE8 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0460;
+ LastUpgradeCheck = 0510;
};
buildConfigurationList = 70C2EB361475EF4F00751AE8 /* Build configuration list for PBXProject "VolumeSnap" */;
compatibilityVersion = "Xcode 3.2";
@@ -212,8 +212,9 @@
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__DUPLICATE_METHOD_MATCH = YES;
@@ -228,11 +229,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;
};
name = Debug;
@@ -241,8 +246,9 @@
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__DUPLICATE_METHOD_MATCH = YES;
@@ -250,9 +256,12 @@
COPY_PHASE_STRIP = 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";
@@ -264,6 +273,7 @@
70C2EB5B1475EF4F00751AE8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "VolumeSnap/VolumeSnap-Prefix.pch";
INFOPLIST_FILE = "VolumeSnap/VolumeSnap-Info.plist";
@@ -275,6 +285,7 @@
70C2EB5C1475EF4F00751AE8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "VolumeSnap/VolumeSnap-Prefix.pch";
INFOPLIST_FILE = "VolumeSnap/VolumeSnap-Info.plist";
diff --git a/VolumeSnap.xcodeproj/xcshareddata/xcschemes/VolumeSnap.xcscheme b/VolumeSnap.xcodeproj/xcshareddata/xcschemes/VolumeSnap.xcscheme
new file mode 100644
index 0000000..c845e06
--- /dev/null
+++ b/VolumeSnap.xcodeproj/xcshareddata/xcschemes/VolumeSnap.xcscheme
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VolumeSnap/AppDelegate.m b/VolumeSnap/AppDelegate.m
index 8d3627a..5fec58c 100644
--- a/VolumeSnap/AppDelegate.m
+++ b/VolumeSnap/AppDelegate.m
@@ -12,11 +12,6 @@ @implementation AppDelegate
@synthesize window = _window;
-- (void)dealloc
-{
- [_window release];
- [super dealloc];
-}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
diff --git a/VolumeSnap/RBVolumeButtons.h b/VolumeSnap/RBVolumeButtons.h
index a39fb5a..62bea07 100644
--- a/VolumeSnap/RBVolumeButtons.h
+++ b/VolumeSnap/RBVolumeButtons.h
@@ -11,19 +11,12 @@
typedef void (^ButtonBlock)();
@interface RBVolumeButtons : NSObject
-{
- float launchVolume;
- BOOL hadToLowerVolume;
- BOOL hadToRaiseVolume;
-
- BOOL _isStealingVolumeButtons;
- BOOL _suspended;
- UIView *_volumeView;
-}
+{}
@property (nonatomic, copy) ButtonBlock upBlock;
@property (nonatomic, copy) ButtonBlock downBlock;
-@property (readonly) float launchVolume;
+@property (nonatomic, readonly) float launchVolume;
+@property (nonatomic, readonly, strong) UIView *volumeView;
-(void)startStealingVolumeButtonEvents;
-(void)stopStealingVolumeButtonEvents;
diff --git a/VolumeSnap/RBVolumeButtons.m b/VolumeSnap/RBVolumeButtons.m
index f070ec2..2099fa8 100644
--- a/VolumeSnap/RBVolumeButtons.m
+++ b/VolumeSnap/RBVolumeButtons.m
@@ -19,19 +19,16 @@ -(void)stopStealingVolumeButtonEvents;
@property BOOL isStealingVolumeButtons;
@property BOOL suspended;
-@property (retain) UIView *volumeView;
+@property (nonatomic, strong) UIView *volumeView;
+@property (nonatomic, readwrite) float launchVolume;
+
+@property (nonatomic) BOOL hadToLowerVolume;
+@property (nonatomic) BOOL hadToRaiseVolume;
@end
@implementation RBVolumeButtons
-@synthesize upBlock;
-@synthesize downBlock;
-@synthesize launchVolume;
-@synthesize isStealingVolumeButtons = _isStealingVolumeButtons;
-@synthesize suspended = _suspended;
-@synthesize volumeView = _volumeView;
-
void volumeListenerCallback (
void *inClientData,
AudioSessionPropertyID inID,
@@ -48,22 +45,22 @@ void volumeListenerCallback (
float volume = *volumePointer;
- if( volume > [(RBVolumeButtons*)inClientData launchVolume] )
+ if( volume > [(__bridge RBVolumeButtons*)inClientData launchVolume] )
{
- [(RBVolumeButtons*)inClientData volumeUp];
+ [(__bridge RBVolumeButtons*)inClientData volumeUp];
}
- else if( volume < [(RBVolumeButtons*)inClientData launchVolume] )
+ else if( volume < [(__bridge RBVolumeButtons*)inClientData launchVolume] )
{
- [(RBVolumeButtons*)inClientData volumeDown];
+ [(__bridge RBVolumeButtons*)inClientData volumeDown];
}
}
-(void)volumeDown
{
- AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, self);
+ AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, (__bridge void *)(self));
- [[MPMusicPlayerController applicationMusicPlayer] setVolume:launchVolume];
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume:self.launchVolume];
[self performSelector:@selector(initializeVolumeButtonStealer) withObject:self afterDelay:0.1];
@@ -76,9 +73,9 @@ -(void)volumeDown
-(void)volumeUp
{
- AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, self);
+ AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, (__bridge void *)(self));
- [[MPMusicPlayerController applicationMusicPlayer] setVolume:launchVolume];
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume:self.launchVolume];
[self performSelector:@selector(initializeVolumeButtonStealer) withObject:self afterDelay:0.1];
@@ -97,52 +94,67 @@ -(id)init
{
self.isStealingVolumeButtons = NO;
self.suspended = NO;
+
+ CGRect frame = CGRectMake(0, -10, 1, 1);
+ self.volumeView = [[MPVolumeView alloc] initWithFrame:frame];
}
return self;
}
-(void)startStealingVolumeButtonEvents
{
- NSAssert([[NSThread currentThread] isMainThread], @"This must be called from the main thread");
-
- if(self.isStealingVolumeButtons) {
- return;
- }
+ NSAssert([[NSThread currentThread] isMainThread], @"This must be called from the main thread");
+
+ if(self.isStealingVolumeButtons) {
+ return;
+ }
self.isStealingVolumeButtons = YES;
-
- AudioSessionInitialize(NULL, NULL, NULL, NULL);
- AudioSessionSetActive(YES);
-
- launchVolume = [[MPMusicPlayerController applicationMusicPlayer] volume];
- hadToLowerVolume = launchVolume == 1.0;
- hadToRaiseVolume = launchVolume == 0.0;
-
+
+ AudioSessionInitialize(NULL, NULL, NULL, NULL);
+
+ UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
+ AudioSessionSetProperty (
+ kAudioSessionProperty_AudioCategory,
+ sizeof (sessionCategory),
+ &sessionCategory
+ );
+
+ AudioSessionSetActive(YES);
+
+ if (!self.volumeView.superview) {
+ [[[[UIApplication sharedApplication] windows] objectAtIndex:0] insertSubview:self.volumeView atIndex:0];
+ }
+
+ self.launchVolume = [[MPMusicPlayerController applicationMusicPlayer] volume];
+ BOOL hadToLowerVolume = self.launchVolume >= 1.0;
+ BOOL hadToRaiseVolume = self.launchVolume <= 0.0;
+
// Avoid flashing the volume indicator
if (hadToLowerVolume || hadToRaiseVolume)
{
- dispatch_async(dispatch_get_current_queue(), ^{
+ double delayInSeconds = 0.01;
+ dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
+ dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
if( hadToLowerVolume )
{
[[MPMusicPlayerController applicationMusicPlayer] setVolume:0.95];
- launchVolume = 0.95;
+ self.launchVolume = 0.95;
}
if( hadToRaiseVolume )
{
[[MPMusicPlayerController applicationMusicPlayer] setVolume:0.05];
- launchVolume = 0.05;
+ self.launchVolume = 0.05;
}
- });
+ });
}
-
- CGRect frame = CGRectMake(0, -100, 10, 0);
- self.volumeView = [[[MPVolumeView alloc] initWithFrame:frame] autorelease];
- [self.volumeView sizeToFit];
- [[[[UIApplication sharedApplication] windows] objectAtIndex:0] addSubview:self.volumeView];
-
- [self initializeVolumeButtonStealer];
-
+ self.hadToLowerVolume = hadToLowerVolume;
+ self.hadToRaiseVolume = hadToRaiseVolume;
+
+
+ [self initializeVolumeButtonStealer];
+
if (!self.suspended)
{
// Observe notifications that trigger suspend
@@ -192,20 +204,21 @@ -(void)stopStealingVolumeButtonEvents
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, self);
+ AudioSessionRemovePropertyListenerWithUserData(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, (__bridge void *)(self));
- if( hadToLowerVolume )
+ if (!self.suspended)
{
- [[MPMusicPlayerController applicationMusicPlayer] setVolume:1.0];
- }
+ if( self.hadToLowerVolume )
+ {
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume:1.0];
+ }
- if( hadToRaiseVolume )
- {
- [[MPMusicPlayerController applicationMusicPlayer] setVolume:0.0];
+ if( self.hadToRaiseVolume )
+ {
+ [[MPMusicPlayerController applicationMusicPlayer] setVolume:0.0];
+ }
}
- [self.volumeView removeFromSuperview];
- self.volumeView = nil;
AudioSessionSetActive(NO);
@@ -214,17 +227,18 @@ -(void)stopStealingVolumeButtonEvents
-(void)dealloc
{
- self.suspended = NO;
+ [self.volumeView removeFromSuperview];
+ self.volumeView = nil;
+
+ self.suspended = NO;
[self stopStealingVolumeButtonEvents];
- self.upBlock = nil;
- self.downBlock = nil;
- [super dealloc];
}
-(void)initializeVolumeButtonStealer
{
- AudioSessionAddPropertyListener(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, self);
+ AudioSessionAddPropertyListener(kAudioSessionProperty_CurrentHardwareOutputVolume, volumeListenerCallback, (__bridge void *)(self));
}
@end
+
diff --git a/VolumeSnap/ViewController.h b/VolumeSnap/ViewController.h
index 87eb39d..f82f531 100644
--- a/VolumeSnap/ViewController.h
+++ b/VolumeSnap/ViewController.h
@@ -14,14 +14,11 @@
@interface ViewController : UIViewController
{
float launchVolume;
- IBOutlet UILabel *counterLabel;
- int counter;
-
RBVolumeButtons *_buttonStealer;
}
-@property (retain) RBVolumeButtons *buttonStealer;
-- (IBAction)startStealing:(id)sender;
-- (IBAction)stopStealing:(id)sender;
+@property (strong) RBVolumeButtons *buttonStealer;
+
+- (IBAction)changeStealing:(id)sender;
@end
diff --git a/VolumeSnap/ViewController.m b/VolumeSnap/ViewController.m
index 72312cf..e987c25 100644
--- a/VolumeSnap/ViewController.m
+++ b/VolumeSnap/ViewController.m
@@ -13,52 +13,66 @@
#import "RBVolumeButtons.h"
+@interface ViewController ()
+
+@property (nonatomic, weak) IBOutlet UILabel *counterLabel;
+@property (weak, nonatomic) IBOutlet UIButton *changeStealingButton;
+@property (nonatomic, assign) NSUInteger counter;
+@property (nonatomic, assign, getter = isStealing) BOOL stealing;
+
+@end
+
@implementation ViewController
@synthesize buttonStealer = _buttonStealer;
+@synthesize counterLabel = counterLabel;
+@synthesize counter = counter;
- (void)didReceiveMemoryWarning
{
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
+ [super didReceiveMemoryWarning];
+ // Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
- [super viewDidLoad];
- counter = 0;
-
- self.buttonStealer = [[[RBVolumeButtons alloc] init] autorelease];
- self.buttonStealer.upBlock = ^{
- counter++;
- [counterLabel setText:[NSString stringWithFormat:@"%i",counter]];
- };
- self.buttonStealer.downBlock = ^{
- counter--;
- [counterLabel setText:[NSString stringWithFormat:@"%i",counter]];
- };
+ [super viewDidLoad];
+ [self.changeStealingButton setTitle:NSLocalizedString(@"Start stealing", nil) forState:UIControlStateNormal];
+
+ counter = 0;
+
+ self.buttonStealer = [[RBVolumeButtons alloc] init];
+ __weak typeof(self) weakSelf = self;
+ self.buttonStealer.upBlock = ^{
+ weakSelf.counter++;
+ [weakSelf.counterLabel setText:[NSString stringWithFormat:@"%@", @(weakSelf.counter)]];
+ };
+ self.buttonStealer.downBlock = ^{
+ weakSelf.counter--;
+ [weakSelf.counterLabel setText:[NSString stringWithFormat:@"%@", @(weakSelf.counter)]];
+ };
}
- (void)viewDidUnload
{
- [counterLabel release];
- counterLabel = nil;
- self.buttonStealer = nil;
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
+ counterLabel = nil;
+ self.buttonStealer = nil;
+ [self setChangeStealingButton:nil];
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
- [super viewWillAppear:animated];
+ [super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
- [super viewDidAppear:animated];
+ [super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
@@ -73,22 +87,25 @@ - (void)viewDidDisappear:(BOOL)animated
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
- // Return YES for supported orientations
- return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
+ // Return YES for supported orientations
+ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-- (void)dealloc {
- [counterLabel release];
- [super dealloc];
-}
-- (IBAction)startStealing:(id)sender
+- (IBAction)changeStealing:(id)sender
{
- [self.buttonStealer startStealingVolumeButtonEvents];
+ if ([self isStealing])
+ {
+ [self.buttonStealer stopStealingVolumeButtonEvents];
+ [self.changeStealingButton setTitle:NSLocalizedString(@"Start stealing", nil) forState:UIControlStateNormal];
+ }
+ else
+ {
+ [self.buttonStealer startStealingVolumeButtonEvents];
+ [self.changeStealingButton setTitle:NSLocalizedString(@"Stop stealing", nil) forState:UIControlStateNormal];
+ }
+
+ self.stealing = !self.stealing;
}
-- (IBAction)stopStealing:(id)sender
-{
- [self.buttonStealer stopStealingVolumeButtonEvents];
-}
@end
diff --git a/VolumeSnap/VolumeSnap-Info.plist b/VolumeSnap/VolumeSnap-Info.plist
index 2186129..64a0532 100644
--- a/VolumeSnap/VolumeSnap-Info.plist
+++ b/VolumeSnap/VolumeSnap-Info.plist
@@ -35,8 +35,6 @@
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
diff --git a/VolumeSnap/en.lproj/MainStoryboard.storyboard b/VolumeSnap/en.lproj/MainStoryboard.storyboard
index dac7e93..652c500 100644
--- a/VolumeSnap/en.lproj/MainStoryboard.storyboard
+++ b/VolumeSnap/en.lproj/MainStoryboard.storyboard
@@ -1,8 +1,8 @@
-
+
-
-
+
+
@@ -10,22 +10,22 @@
-
+
-
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-