diff --git a/Demo/TSPopoverDemo.xcodeproj/project.pbxproj b/Demo/TSPopoverDemo.xcodeproj/project.pbxproj index 43c84e4..68cbd2a 100644 --- a/Demo/TSPopoverDemo.xcodeproj/project.pbxproj +++ b/Demo/TSPopoverDemo.xcodeproj/project.pbxproj @@ -269,7 +269,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TSPopoverDemo/TSPopoverDemo-Prefix.pch"; INFOPLIST_FILE = "TSPopoverDemo/TSPopoverDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; @@ -282,7 +282,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "TSPopoverDemo/TSPopoverDemo-Prefix.pch"; INFOPLIST_FILE = "TSPopoverDemo/TSPopoverDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; diff --git a/TSPopover/TSActionSheet.m b/TSPopover/TSActionSheet.m index 99c6a46..ca5cea8 100644 --- a/TSPopover/TSActionSheet.m +++ b/TSPopover/TSActionSheet.m @@ -15,6 +15,12 @@ #define TITLE_SHADOW_OFFSET CGSizeMake(0, -1) #define BUTTON_HEIGHT 35 +@interface TSActionSheet() + +- (void)buildButtons; +- (UIImage*)buttonImage:(UIColor*)color borderWidth:(NSUInteger)borderWidth borderColor:(UIColor*)borderColor; +@end + @implementation TSActionSheet @synthesize cornerRadius = _cornerRadius; diff --git a/TSPopover/TSPopoverController.m b/TSPopover/TSPopoverController.m index 2e2674f..e3999f6 100644 --- a/TSPopover/TSPopoverController.m +++ b/TSPopover/TSPopoverController.m @@ -21,7 +21,11 @@ #define ARROW_MARGIN 2 @interface TSPopoverController () - +- (void) checkArrowPosition:(CGRect)senderRect; +- (CGPoint)senderPointFromSenderRect:(CGRect)senderRect; +- (void) showPopoverWithPoint:(CGPoint)senderPoint; +- (CGRect) contentFrameRect:(CGRect)contentFrame senderPoint:(CGPoint)senderPoint; +- (CGRect)popoverFrameRect:(CGRect)contentFrame senderPoint:(CGPoint)senderPoint; @end @implementation TSPopoverController @@ -188,7 +192,7 @@ - (void) showPopoverWithPoint:(CGPoint)senderPoint UIWindow *appWindow = [[UIApplication sharedApplication] keyWindow]; //[appWindow addSubview:self.view]; - [appWindow.rootViewController.view addSubview:self.view]; + [appWindow addSubview:self.view]; [UIView animateWithDuration:0.0 @@ -331,7 +335,7 @@ - (CGRect)popoverFrameRect:(CGRect)contentFrame senderPoint:(CGPoint)senderPoint popoverRect = CGRectMake(popoverX, popoverY, popoverWidth, popoverHeight); - }else if(self.arrowPosition = TSPopoverArrowPositionHorizontal){ + }else if(self.arrowPosition == TSPopoverArrowPositionHorizontal){ popoverWidth = contentFrame.size.width+ARROW_SIZE+MARGIN*2; popoverHeight = contentFrame.size.height+titleLabelheight+MARGIN*2; diff --git a/TSPopover/TSPopoverPopoverView.m b/TSPopover/TSPopoverPopoverView.m index 3a6f5a8..c6ee781 100644 --- a/TSPopover/TSPopoverPopoverView.m +++ b/TSPopover/TSPopoverPopoverView.m @@ -12,6 +12,10 @@ #define MARGIN 5 #define ARROW_SIZE 20 +@interface TSPopoverPopoverView() +-(UIImage*)backgroundImage; +@end + @implementation TSPopoverPopoverView @synthesize cornerRadius = _cornerRadius; @@ -34,7 +38,7 @@ - (id)init - (void)drawRect:(CGRect)rect { - UIImage *backgroundImage = self.backgroundImage; + UIImage *backgroundImage = [self backgroundImage]; [backgroundImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) blendMode:kCGBlendModeNormal alpha:1]; }