Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.

Automatically adjust kGKAchievementFrameEnd if statusbar is not hidden. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion GKAchievementNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ @interface GKAchievementNotification(private)
- (void)animationInDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context;
- (void)animationOutDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context;
- (void)delegateCallback:(SEL)selector withObject:(id)object;
- (CGRect)adjustedFrameEnd;

@end

Expand Down Expand Up @@ -46,6 +47,15 @@ - (void)delegateCallback:(SEL)selector withObject:(id)object
}
}

- (CGRect)adjustedFrameEnd {
CGRect frameEnd = kGKAchievementFrameEnd;
UIApplication *application = [UIApplication sharedApplication];
if (!application.statusBarHidden) {
frameEnd.origin.y += application.statusBarFrame.size.height;
}
return frameEnd;
}

@end

#pragma mark -
Expand Down Expand Up @@ -174,7 +184,7 @@ - (void)animateIn
[UIView setAnimationDelegate:self];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDidStopSelector:@selector(animationInDidStop:finished:context:)];
self.frame = kGKAchievementFrameEnd;
self.frame = [self adjustedFrameEnd];
[UIView commitAnimations];
}

Expand Down