forked from glenyi/TPFloatRatingView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTPFloatRatingView.h
86 lines (68 loc) · 1.87 KB
/
TPFloatRatingView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// TPFloatRatingView.h
// TPFloatRatingViewApp
//
// Created by Glen Yi on 2/26/2014.
// Copyright (c) 2014 Glen Yi. All rights reserved.
//
// Version 1.0
#import <UIKit/UIKit.h>
@protocol TPFloatRatingViewDelegate;
/**
A simple rating view that can set whole, half or floating point ratings.
*/
@interface TPFloatRatingView : UIView
@property (weak, nonatomic) id <TPFloatRatingViewDelegate> delegate;
/**
Sets the empty image (e.g. a star outline)
*/
@property (strong, nonatomic) UIImage *emptySelectedImage;
/**
Sets the full image that is overlayed on top of the empty image.
Should be same size and shape as the empty image.
*/
@property (strong, nonatomic) UIImage *fullSelectedImage;
/**
Sets the empty and full image view content mode. Defaults to UIViewContentModeCenter.
*/
@property (nonatomic) UIViewContentMode contentMode;
/**
Minimum rating. Default is 0.
*/
@property (nonatomic) NSInteger minRating;
/**
Max rating value. Default is 5.
*/
@property (nonatomic) NSInteger maxRating;
/**
Minimum image size. Default is CGSize(5,5).
*/
@property (nonatomic) CGSize minImageSize;
/**
Set the current rating. Default is 0.
*/
@property (nonatomic) CGFloat rating;
/**
Sets whether or not the rating view is editable. Default is NO.
*/
@property (nonatomic) BOOL editable;
/**
Ratings change by 0.5. Overrides floatRatings property. Default is NO.
*/
@property (nonatomic) BOOL halfRatings;
/**
Ratings change by floating point values. Default is NO.
*/
@property (nonatomic) BOOL floatRatings;
@end
@protocol TPFloatRatingViewDelegate <NSObject>
@optional
/**
Returns the rating value when touch events end.
*/
- (void)floatRatingView:(TPFloatRatingView *)ratingView ratingDidChange:(CGFloat)rating;
/**
Returns the rating value as the user pans.
*/
- (void)floatRatingView:(TPFloatRatingView *)ratingView continuousRating:(CGFloat)rating;
@end