Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AwakeFromNib and Change Notification #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>09A37E81E2779F3D6604F6191D8167333DDE49BD</key>
<string>https://github.com/danwilliams64/DJWStarRatingView.git</string>
<string>github.com:ijameelkhan/DJWStarRatingView.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>DJWStarRatingView.xcodeproj/project.xcworkspace</string>
<string>DJWStarRatingView.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>09A37E81E2779F3D6604F6191D8167333DDE49BD</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/danwilliams64/DJWStarRatingView.git</string>
<string>github.com:ijameelkhan/DJWStarRatingView.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
Expand Down
5 changes: 5 additions & 0 deletions DJWStarRatingView/DJWStarRatingView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

@import UIKit;


#define kDJWStarRatingViewChangeNotification @"kDJWStarRatingViewChangeNotification"


IB_DESIGNABLE

@interface DJWStarRatingView : UIView

/**
Expand Down
12 changes: 12 additions & 0 deletions DJWStarRatingView/DJWStarRatingView.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ - (instancetype)initWithStarSize:(CGSize)starSize
return self;
}


- (void)awakeFromNib{

_allowsSwipeWhenEditable = YES;
_allowsTapWhenEditable = YES;
_allowsHalfIntegralRatings = YES;


}


- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
Expand Down Expand Up @@ -73,6 +84,7 @@ - (void)processGestureRecogniser:(UIGestureRecognizer *)gesture

CGPoint point = [gesture locationInView:self];
self.rating = [self ratingAtPoint:point];
[[NSNotificationCenter defaultCenter] postNotificationName:kDJWStarRatingViewChangeNotification object:self];
}

- (float)ratingAtPoint:(CGPoint)point
Expand Down