#import <DLStarView.h>
Definition at line 17 of file DLStarView.h.
◆ centerIn:with:()
- (void) centerIn: |
|
(CGRect) |
_frame |
with: |
|
(int) |
numberOfStars |
|
|
| |
Definition at line 67 of file DLStarView.m.
67 :(CGRect)_frame with:(
int)numberOfStars {
68 CGSize size =
self.frame.size;
70 float height =
self.frame.size.height;
71 float frameHeight = _frame.size.height;
72 float newY = (frameHeight-height)/2;
74 float widthOfStars =
self.frame.size.width * numberOfStars;
75 float frameWidth = _frame.size.width;
76 float gapToApply = (frameWidth-widthOfStars)/2;
78 self.frame = CGRectMake((size.width*
self.tag) + gapToApply, newY, size.width, size.height);
◆ croppedImage:()
- (UIImage *) croppedImage: |
|
(UIImage*) |
image |
|
Definition at line 44 of file DLStarView.m.
47 float xOffset = partWidth*part;
48 CGRect newFrame = CGRectMake(xOffset, 0, partWidth , image.size.height * image.scale);
49 CGImageRef resultImage = CGImageCreateWithImageInRect([image CGImage], newFrame);
50 UIImage *result = [UIImage imageWithCGImage:resultImage scale:image.scale orientation:image.imageOrientation];
51 CGImageRelease(resultImage);
#define kNumberOfFractions
◆ hitTest:withEvent:()
- (UIView *) hitTest: |
|
(CGPoint) |
point |
withEvent: |
|
(UIEvent *) |
event |
|
|
| |
|
implementation |
Definition at line 60 of file DLStarView.m.
60 :(CGPoint)point withEvent:(UIEvent *)
event {
61 return self.superview;
◆ initWithDefault:highlighted:position:allowFractions:()
- (id) initWithDefault: |
|
(UIImage*) |
star |
highlighted: |
|
(UIImage*) |
highlightedStar |
position: |
|
(int) |
index |
allowFractions: |
|
(BOOL) |
fractions |
|
|
| |
Definition at line 21 of file DLStarView.m.
21 :(UIImage*)star highlighted:(UIImage*)highlightedStar position:(int)index allowFractions:(BOOL)fractions {
22 self = [
super initWithFrame:CGRectZero];
27 highlightedStar = [
self croppedImage:highlightedStar];
28 star = [
self croppedImage:star];
30 self.frame = CGRectMake((star.size.width*index), 0, star.size.width, star.size.height+
kEdgeInsetBottom);
31 [
self setStarImage:star highlightedStarImage:highlightedStar];
32 [
self setImageEdgeInsets:UIEdgeInsetsMake(0, 0, kEdgeInsetBottom, 0)];
33 [
self setBackgroundColor:[UIColor clearColor]];
35 [
self setAccessibilityLabel:@"1 star"];
37 [
self setAccessibilityLabel:[NSString stringWithFormat:@"%d stars", index+1]];
◆ setStarImage:highlightedStarImage:()
- (void) setStarImage: |
|
(UIImage*) |
starImage |
highlightedStarImage: |
|
(UIImage*) |
highlightedImage |
|
|
| |
Definition at line 81 of file DLStarView.m.
81 :(UIImage*)starImage highlightedStarImage:(UIImage*)highlightedImage {
82 [
self setImage:starImage forState:UIControlStateNormal];
83 [
self setImage:highlightedImage forState:UIControlStateSelected];
84 [
self setImage:highlightedImage forState:UIControlStateHighlighted];
The documentation for this class was generated from the following files: