Skip to content

Commit 56f020c

Browse files
committed
Merge pull request #81 from mhaleem/master
Use Preprocessor Macro for App Extension target to avoid compile erro…
2 parents cbfbb67 + 6000d1d commit 56f020c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

Classes/NavigationController/UINavigationController+M13ProgressViewBar.m

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@ - (void)cancelProgress
129129
}
130130
}
131131

132+
#pragma mark Orientation
133+
134+
- (UIInterfaceOrientation)currentDeviceOrientation
135+
{
136+
UIInterfaceOrientation orientation;
137+
138+
//Define "M13_APP_EXTENSIONS" Preprocessor Macro for App Extension target
139+
#if defined(M13_APP_EXTENSIONS)
140+
if ([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height) {
141+
orientation = UIInterfaceOrientationPortrait;
142+
} else {
143+
orientation = UIInterfaceOrientationLandscapeLeft;
144+
}
145+
#else
146+
orientation = [UIApplication sharedApplication].statusBarOrientation;
147+
#endif
148+
149+
return orientation;
150+
}
151+
132152
#pragma mark Drawing
133153

134154
- (void)showProgress
@@ -144,7 +164,7 @@ - (void)showProgress
144164

145165
- (void)updateProgress
146166
{
147-
[self updateProgressWithInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation];
167+
[self updateProgressWithInterfaceOrientation:[self currentDeviceOrientation]];
148168
}
149169

150170
- (void)updateProgressWithInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
@@ -213,7 +233,7 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie
213233

214234
- (void)drawIndeterminate
215235
{
216-
[self drawIndeterminateWithInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation];
236+
[self drawIndeterminateWithInterfaceOrientation:[self currentDeviceOrientation]];
217237
}
218238

219239
- (void)drawIndeterminateWithInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

0 commit comments

Comments
 (0)