Skip to content

Commit

Permalink
ARC; generate images; geometry fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoerl committed Nov 22, 2011
1 parent 502b613 commit d5644b2
Show file tree
Hide file tree
Showing 18 changed files with 667 additions and 226 deletions.
2 changes: 0 additions & 2 deletions Classes/Popover/UIBarButtonItem+WEPopover.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ - (CGRect)frameInView:(UIView *)v {
if (!hasCustomView) {
UIView *tempView = [[UIView alloc] initWithFrame:CGRectZero];
self.customView = tempView;
[tempView release];
}

UIView *parentView = self.customView.superview;
Expand All @@ -38,7 +37,6 @@ - (UIView *)superview {
if (!hasCustomView) {
UIView *tempView = [[UIView alloc] initWithFrame:CGRectZero];
self.customView = tempView;
[tempView release];
}

UIView *parentView = self.customView.superview;
Expand Down
71 changes: 31 additions & 40 deletions Classes/Popover/WEPopoverContainerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,31 @@
// Copyright 2010 Werner IT Consultancy. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
* @brief Properties for the container view determining the area where the actual content view can/may be displayed. Also Images can be supplied for the arrow images and background.
*/
@interface WEPopoverContainerViewProperties : NSObject
{
NSString *bgImageName;
NSString *upArrowImageName;
NSString *downArrowImageName;
NSString *leftArrowImageName;
NSString *rightArrowImageName;
CGFloat leftBgMargin;
CGFloat rightBgMargin;
CGFloat topBgMargin;
CGFloat bottomBgMargin;
NSInteger topBgCapSize;
NSInteger leftBgCapSize;
CGFloat arrowMargin;
}

typedef struct {
CGColorRef topColor;
CGColorRef botColor;
CGColorRef lineColor;
CGSize size; // image size
CGRect contentRect; // returned parameter after image is drawn
CGFloat radius;
CGFloat borderWidth;
CGFloat calloutHeight;
CGFloat calloutRatio; // width of base relative to height - default to 0.75f
UIPopoverArrowDirection direction;
} popupSpec;

@property(nonatomic, retain) NSString *bgImageName;
@property(nonatomic, retain) NSString *upArrowImageName;
@property(nonatomic, retain) NSString *downArrowImageName;
@property(nonatomic, retain) NSString *leftArrowImageName;
@property(nonatomic, retain) NSString *rightArrowImageName;
@interface WEPopoverContainerViewProperties : NSObject
#ifndef DRAW_IMAGES
@property(nonatomic, strong) NSString *bgImageName;
@property(nonatomic, strong) NSString *upArrowImageName;
@property(nonatomic, strong) NSString *downArrowImageName;
@property(nonatomic, strong) NSString *leftArrowImageName;
@property(nonatomic, strong) NSString *rightArrowImageName;
#endif
@property(nonatomic, assign) CGFloat leftBgMargin;
@property(nonatomic, assign) CGFloat rightBgMargin;
@property(nonatomic, assign) CGFloat topBgMargin;
Expand All @@ -40,9 +39,17 @@
@property(nonatomic, assign) CGFloat rightContentMargin;
@property(nonatomic, assign) CGFloat topContentMargin;
@property(nonatomic, assign) CGFloat bottomContentMargin;
#ifndef DRAW_IMAGES
@property(nonatomic, assign) NSInteger topBgCapSize;
@property(nonatomic, assign) NSInteger leftBgCapSize;
@property(nonatomic, assign) CGFloat arrowMargin;
@property(nonatomic, assign) CGFloat arrowOffset;
#endif
@property(nonatomic, assign) BOOL useLayerShadows;

#ifdef DRAW_IMAGES
@property(nonatomic, assign) popupSpec spec;
#endif

@end

Expand All @@ -51,23 +58,7 @@
/**
* @brief Container/background view for displaying a popover view.
*/
@interface WEPopoverContainerView : UIView {
UIImage *bgImage;
UIImage *arrowImage;

WEPopoverContainerViewProperties *properties;

UIPopoverArrowDirection arrowDirection;

CGRect arrowRect;
CGRect bgRect;
CGPoint offset;
CGPoint arrowOffset;

CGSize correctedSize;
UIView *contentView;
}

@interface WEPopoverContainerView : UIView
/**
* @brief The current arrow direction for the popover.
*/
Expand All @@ -76,7 +67,7 @@
/**
* @brief The content view being displayed.
*/
@property (nonatomic, retain) UIView *contentView;
@property (nonatomic, strong) UIView *contentView;

/**
* @brief Initializes the position of the popover with a size, anchor rect, display area and permitted arrow directions and optionally the properties.
Expand Down
Loading

0 comments on commit d5644b2

Please sign in to comment.