Skip to content
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
23 changes: 23 additions & 0 deletions LUNSegmentedControl.podspec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "LUNSegmentedControl",
"version": "1.0.7",
"summary": "Customizable segmented control with interaсtive animation. It provide liquid shape for selection.",
"description": "Customizable segmented control with interactive animation, liquid shape of selection, gradients for each state and shadow.",
"homepage": "https://github.com/LunApps/LUNSegmentedControl",
"license": {
"type": "MIT",
"file": "LICENSE"
},
"authors": {
"Andrii Selivanov": "andrey@lunapps.com"
},
"platforms": {
"ios": "8.0"
},
"source": {
"git": "https://github.com/LunApps/LUNSegmentedControl.git",
"tag": "1.0.7"
},
"source_files": "LUNSegmentedControl/LUNSegmentedControl/LUNSegmentedControl/*.{h,m}",
"requires_arc": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ typedef NS_ENUM(NSUInteger, LUNSegmentedControlBounce) {
* @see segmentedControl:setupStateAtIndex:stateView:selectedView:withSelectionPercent:
*/
- (void)segmentedControl:(LUNSegmentedControl *)segmentedControl resetStateAtIndex:(NSInteger)stateIndex stateView:(UIView *)stateView selectedView:(UIView *)selectedView;
/**
* @brief Asks the delegate to setup shadow.
*
* @param segmentedControl LUNSegmentedControl instance that asks delegate.
* @param shadowView Shadow view.
*/
- (void)segmentedControl:(LUNSegmentedControl *)segmentedControl setupShadowView:(UIView *)shadowView;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,14 @@ - (UIColor *)shadowColorForStateAtIndex:(NSInteger)index {
return self.selectorViewColor;
}
- (void)setupShadowForStateAtIndex:(NSInteger)index visible:(BOOL)visible animated:(BOOL)animated {
self.shadowView.layer.shadowColor = [self shadowColorForStateAtIndex:index].CGColor;
self.shadowView.layer.shadowRadius = 7.0;
self.shadowView.layer.shadowOffset = CGSizeMake(0, 5);
if ([self.delegate respondsToSelector:@selector(segmentedControl:setupShadowView:)]) {
[self.delegate segmentedControl:self setupShadowView:self.shadowView];
} else {
self.shadowView.layer.shadowColor = [self shadowColorForStateAtIndex:index].CGColor;
self.shadowView.layer.shadowRadius = 7.0;
self.shadowView.layer.shadowOffset = CGSizeMake(0, 5);
}

CGAffineTransform transform = CGAffineTransformMakeTranslation(self.stateViews[index].bounds.size.width * [self percentFromOffset:[self offsetFromState:index]], 0);
CGPathRef transformedPath = CGPathCreateCopyByTransformingPath([self pathForSelectorViewFromPercentage:0], &transform);
self.shadowView.layer.shadowPath = transformedPath;
Expand Down