Skip to content

Commit 51b07e7

Browse files
committed
Merge branch 'master' into ios7
Conflicts: SIAlertView/SIAlertView.h SIAlertView/SIAlertView.m
2 parents dd2412a + 747e53d commit 51b07e7

3 files changed

Lines changed: 52 additions & 8 deletions

File tree

SIAlertView.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Pod::Spec.new do |s|
22
s.name = 'SIAlertView'
3-
s.version = '1.3'
3+
s.version = '1.3.1'
44
s.platform = :ios, '5.0'
55
s.license = 'MIT'
66
s.summary = 'An UIAlertView replacement.'
77
s.homepage = 'https://github.com/Sumi-Interactive/SIAlertView'
88
s.author = { 'Sumi Interactive' => '[email protected]' }
99
s.source = { :git => 'https://github.com/Sumi-Interactive/SIAlertView.git',
10-
:tag => '1.3' }
10+
:tag => '1.3.1' }
1111

1212
s.description = 'An UIAlertView replacement with block syntax and fancy transition styles.'
1313

SIAlertView/SIAlertView.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef void(^SIAlertViewHandler)(SIAlertView *alertView);
4949
@property (nonatomic, copy) NSAttributedString *attributedMessage;
5050

5151
@property (nonatomic, assign) SIAlertViewTransitionStyle transitionStyle; // default is SIAlertViewTransitionStyleSlideFromBottom
52-
@property (nonatomic, assign) SIAlertViewBackgroundStyle backgroundStyle; // default is SIAlertViewButtonTypeSolid
52+
@property (nonatomic, assign) SIAlertViewBackgroundStyle backgroundStyle; // default is SIAlertViewBackgroundStyleSolid
5353
@property (nonatomic, assign) SIAlertViewButtonsListStyle buttonsListStyle; // default is SIAlertViewButtonsListStyleNormal
5454

5555
@property (nonatomic, copy) SIAlertViewHandler willShowHandler;
@@ -59,10 +59,12 @@ typedef void(^SIAlertViewHandler)(SIAlertView *alertView);
5959

6060
@property (nonatomic, readonly, getter = isVisible) BOOL visible;
6161

62+
6263
// theme
6364

6465
@property (nonatomic, strong) UIColor *viewBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is [UIColor white]
6566
@property (nonatomic, strong) UIColor *seperatorColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is [UIColor colorWithWhite:0 alpha:0.1]
67+
6668
@property (nonatomic, assign) CGFloat cornerRadius NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 2.0
6769
@property (nonatomic, assign) CGFloat shadowRadius NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is 0.0
6870

SIAlertView/SIAlertView.m

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#define BUTTON_HEIGHT 50
2424
#define CONTAINER_WIDTH 270
2525

26-
const UIWindowLevel UIWindowLevelSIAlert = 1999.0; // don't overlap system's alert
27-
const UIWindowLevel UIWindowLevelSIAlertBackground = 1998.0; // below the alert window
26+
const UIWindowLevel UIWindowLevelSIAlert = 1996.0; // don't overlap system's alert
27+
const UIWindowLevel UIWindowLevelSIAlertBackground = 1985.0; // below the alert window
2828

2929
@class SIAlertBackgroundWindow;
3030

@@ -278,9 +278,14 @@ + (void)setAnimating:(BOOL)animating
278278
+ (void)showBackground
279279
{
280280
if (!__si_alert_background_window) {
281-
CGFloat width = [UIScreen mainScreen].bounds.size.width;
282-
CGFloat height = [UIScreen mainScreen].bounds.size.height;
283-
__si_alert_background_window = [[SIAlertBackgroundWindow alloc] initWithFrame:CGRectMake(0, 0, MIN(width, height), MAX(width, height))
281+
CGRect frame = [[UIScreen mainScreen] bounds];
282+
if([[UIScreen mainScreen] respondsToSelector:@selector(fixedCoordinateSpace)])
283+
{
284+
frame = [[[UIScreen mainScreen] fixedCoordinateSpace] convertRect:frame fromCoordinateSpace:[[UIScreen mainScreen] coordinateSpace]];
285+
}
286+
287+
__si_alert_background_window = [[SIAlertBackgroundWindow alloc] initWithFrame:frame
288+
284289
andStyle:[SIAlertView currentAlertView].backgroundStyle];
285290
[__si_alert_background_window makeKeyAndVisible];
286291
__si_alert_background_window.alpha = 0;
@@ -512,6 +517,9 @@ - (void)show
512517
self.didShowHandler(self);
513518
}
514519
[[NSNotificationCenter defaultCenter] postNotificationName:SIAlertViewDidShowNotification object:self userInfo:nil];
520+
#ifdef __IPHONE_7_0
521+
[self addParallaxEffect];
522+
#endif
515523

516524
[SIAlertView setAnimating:NO];
517525

@@ -536,6 +544,9 @@ - (void)dismissAnimated:(BOOL)animated cleanup:(BOOL)cleanup
536544
self.willDismissHandler(self);
537545
}
538546
[[NSNotificationCenter defaultCenter] postNotificationName:SIAlertViewWillDismissNotification object:self userInfo:nil];
547+
#ifdef __IPHONE_7_0
548+
[self removeParallaxEffect];
549+
#endif
539550
}
540551

541552
void (^dismissComplete)(void) = ^{
@@ -877,6 +888,7 @@ - (CGFloat)heightForTitleLabel
877888
context:nil];
878889
return ceil(rect.size.height);
879890
}
891+
880892
return 0;
881893
}
882894

@@ -1225,4 +1237,34 @@ - (NSDictionary *)destructiveButtonAttributes
12251237
return attributes;
12261238
}
12271239

1240+
# pragma mark -
1241+
# pragma mark Enable parallax effect (iOS7 only)
1242+
1243+
#ifdef __IPHONE_7_0
1244+
- (void)addParallaxEffect
1245+
{
1246+
if (_enabledParallaxEffect && NSClassFromString(@"UIInterpolatingMotionEffect"))
1247+
{
1248+
UIInterpolatingMotionEffect *effectHorizontal = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"position.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
1249+
UIInterpolatingMotionEffect *effectVertical = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"position.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
1250+
[effectHorizontal setMaximumRelativeValue:@(20.0f)];
1251+
[effectHorizontal setMinimumRelativeValue:@(-20.0f)];
1252+
[effectVertical setMaximumRelativeValue:@(50.0f)];
1253+
[effectVertical setMinimumRelativeValue:@(-50.0f)];
1254+
[self.containerView addMotionEffect:effectHorizontal];
1255+
[self.containerView addMotionEffect:effectVertical];
1256+
}
1257+
}
1258+
1259+
- (void)removeParallaxEffect
1260+
{
1261+
if (_enabledParallaxEffect && NSClassFromString(@"UIInterpolatingMotionEffect"))
1262+
{
1263+
[self.containerView.motionEffects enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
1264+
[self.containerView removeMotionEffect:obj];
1265+
}];
1266+
}
1267+
}
1268+
#endif
1269+
12281270
@end

0 commit comments

Comments
 (0)