diff --git a/PopoverView/PopoverView.m b/PopoverView/PopoverView.m index d23ab9c..bf7fe88 100644 --- a/PopoverView/PopoverView.m +++ b/PopoverView/PopoverView.m @@ -169,7 +169,7 @@ - (void)showAtPoint:(CGPoint)point inView:(UIView *)view withText:(NSString *)te [textView setNumberOfLines:0]; //This is so the label word wraps instead of cutting off the text textView.font = font; textView.textAlignment = kTextAlignment; - textView.textColor = [UIColor colorWithRed:0.329 green:0.341 blue:0.353 alpha:1]; + textView.textColor = kTextColor; textView.text = text; [self showAtPoint:point inView:view withViewArray:[NSArray arrayWithObject:[textView autorelease]]]; @@ -188,7 +188,7 @@ - (void)showAtPoint:(CGPoint)point inView:(UIView *)view withTitle:(NSString *)t [textView setNumberOfLines:0]; //This is so the label word wraps instead of cutting off the text textView.font = font; textView.textAlignment = kTextAlignment; - textView.textColor = [UIColor colorWithRed:0.329 green:0.341 blue:0.353 alpha:1]; + textView.textColor = kTextColor; textView.text = text; [self showAtPoint:point inView:view withTitle:title withViewArray:[NSArray arrayWithObject:[textView autorelease]]]; @@ -365,7 +365,7 @@ - (void)showAtPoint:(CGPoint)point inView:(UIView *)view withStringArray:(NSArra [textButton setTitle:string forState:UIControlStateNormal]; textButton.layer.cornerRadius = 4.f; [textButton setTitleColor:kTextColor forState:UIControlStateNormal]; - [textButton setTitleColor:[UIColor colorWithRed:0.098 green:0.102 blue:0.106 alpha:1.000] forState:UIControlStateHighlighted]; + [textButton setTitleColor:kTextHighlightColor forState:UIControlStateHighlighted]; [textButton addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside]; [labelArray addObject:[textButton autorelease]]; @@ -390,7 +390,7 @@ - (void)showAtPoint:(CGPoint)point inView:(UIView *)view withTitle:(NSString *)t [textButton setTitle:string forState:UIControlStateNormal]; textButton.layer.cornerRadius = 4.f; [textButton setTitleColor:kTextColor forState:UIControlStateNormal]; - [textButton setTitleColor:[UIColor colorWithRed:0.098 green:0.102 blue:0.106 alpha:1.000] forState:UIControlStateHighlighted]; + [textButton setTitleColor:kTextHighlightColor forState:UIControlStateHighlighted]; [textButton addTarget:self action:@selector(didTapButton:) forControlEvents:UIControlEventTouchUpInside]; [labelArray addObject:[textButton autorelease]]; @@ -480,10 +480,7 @@ - (void)showAtPoint:(CGPoint)point inView:(UIView *)view withContentView:(UIView // get the top view // http://stackoverflow.com/questions/3843411/getting-reference-to-the-top-most-view-window-in-ios-application/8045804#8045804 - UIWindow *topWindow = [[[UIApplication sharedApplication].windows sortedArrayUsingComparator:^NSComparisonResult(UIWindow *win1, UIWindow *win2) { - return win1.windowLevel - win2.windowLevel; - }] lastObject]; - topView = [[topWindow subviews] lastObject]; + topView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject]; [self setupLayout:point inView:view]; @@ -921,7 +918,7 @@ - (void)drawRect:(CGRect)rect CGContextRef context = UIGraphicsGetCurrentContext(); //// Shadow Declarations - UIColor* shadow = [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:kShadowAlpha]; + UIColor* shadow = [UIColor colorWithWhite:0.0f alpha:kShadowAlpha]; CGSize shadowOffset = CGSizeMake(0, 1); CGFloat shadowBlurRadius = kShadowBlur; @@ -1040,9 +1037,4 @@ - (void)drawRect:(CGRect)rect } } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - return YES; -} - @end diff --git a/PopoverView/PopoverView_Configuration.h b/PopoverView/PopoverView_Configuration.h index be5a853..0c00fd8 100644 --- a/PopoverView/PopoverView_Configuration.h +++ b/PopoverView/PopoverView_Configuration.h @@ -87,6 +87,8 @@ //normal text color #define kTextColor [UIColor colorWithRed:0.329 green:0.341 blue:0.353 alpha:1] +// highlighted text color +#define kTextHighlightColor [UIColor colorWithRed:0.098 green:0.102 blue:0.106 alpha:1.000] //normal text alignment #define kTextAlignment UITextAlignmentCenter diff --git a/popover/Demo/ViewController.m b/popover/Demo/ViewController.m index 7049d64..6ed21c8 100644 --- a/popover/Demo/ViewController.m +++ b/popover/Demo/ViewController.m @@ -171,7 +171,10 @@ - (void)viewDidUnload - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return YES; + return UIInterfaceOrientationIsLandscape(interfaceOrientation); + // or, depending on the app setup, one of + // return UIInterfaceOrientationIsPortrait(interfaceOrientation); + // return YES; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration diff --git a/popover/Demo/popover-Info.plist b/popover/Demo/popover-Info.plist index 65c6d5f..725931c 100644 --- a/popover/Demo/popover-Info.plist +++ b/popover/Demo/popover-Info.plist @@ -34,8 +34,6 @@ UISupportedInterfaceOrientations - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight @@ -43,8 +41,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown