-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from rsimenok/development
Release 1.1
- Loading branch information
Showing
25 changed files
with
790 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## Build generated | ||
build/ | ||
DerivedData/ | ||
|
||
## Various settings | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata/ | ||
|
||
## Other | ||
*.moved-aside | ||
*.xccheckout | ||
*.xcscmblueprint | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
# CocoaPods | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# | ||
# Pods/ | ||
|
||
# Carthage | ||
# | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
# screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
|
||
# Code Injection | ||
# | ||
# After new code Injection tools there's a generated folder /iOSInjectionProject | ||
# https://github.com/johnno1962/injectionforxcode | ||
|
||
iOSInjectionProject/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
# RSSliderView | ||
RSSliderView is a simple control for IOS based on UIView Class. | ||
RSSliderView is a simple control for iOS based on UIView class. | ||
|
||
Here a preview: | ||
Preview: | ||
|
||
 | ||
<img src="http://i.piccy.info/i9/7755a8dc23dba093e99bbb8dbb63e059/1542282938/26269/1282420/Simulator_Screen_Shot_iPhone_5s_2018_11_15_at_13_51_49.png" alt="Slider preview" width="300"> | ||
|
||
To create slider just do: | ||
## Create | ||
RSSliderView is IBDesignable so you can create it in IB or programmatically as you prefer. | ||
|
||
``` Objective-C | ||
RSSliderView *horSlider = [[RSSliderView alloc] initWithFrame:CGRectMake(40, 40, 300, 80) andOrientation:Horizontal]; | ||
RSSliderView *horSlider = [[RSSliderView alloc] initWithFrame:CGRectMake(20, 40, 280, 70)]; | ||
horSlider.delegate = self; | ||
[horSlider setColorsForBackground:[UIColor colorWithRed:27.0/255.0 green:28.0/255.0 blue:37.0/255.0 alpha:1.0] | ||
foreground:[UIColor colorWithRed:0.0 green:106.0/255.0 blue:95.0/255.0 alpha:1.0] | ||
handle:[UIColor colorWithRed:0.0 green:205.0/255.0 blue:184.0/255.0 alpha:1.0] | ||
border:[UIColor colorWithRed:0.0 green:205.0/255.0 blue:184.0/255.0 alpha:1.0]]; | ||
horSlider.label.text = @"Horizontal slider"; | ||
horSlider.label.font = [UIFont fontWithName:@"Helvetica" size:25]; | ||
horSlider.label.textColor = [UIColor colorWithRed:0.0 green:205.0/255.0 blue:184.0/255.0 alpha:1.0]; | ||
horSlider.backgroundColor = [UIColor colorWithRed:27.0/255.0 green:28.0/255.0 blue:37.0/255.0 alpha:1.0]; | ||
horSlider.foregroundColor = [UIColor colorWithRed:0.0 green:106.0/255.0 blue:95.0/255.0 alpha:1.0]; | ||
horSlider.handleColor = [UIColor colorWithRed:0.0 green:205.0/255.0 blue:184.0/255.0 alpha:1.0]; | ||
horSlider.borderColor = [UIColor colorWithRed:0.0 green:205.0/255.0 blue:184.0/255.0 alpha:1.0]; | ||
horSlider.text = @"Horizontal slider"; | ||
horSlider.textColor = [UIColor colorWithRed:0.0 green:205.0/255.0 blue:184.0/255.0 alpha:1.0]; | ||
[self.view addSubview:horSlider]; | ||
``` | ||
after you set delegate you can get values from slider | ||
Observe slider value change via delegate | ||
``` Objective-C | ||
-(void)sliderValueChanged:(RSSliderView *)sender { | ||
NSLog(@"Value Changed: %f", sender.value); | ||
} | ||
-(void)sliderValueChangeEnded:(RSSliderView *)sender { | ||
NSLog(@"Touch ended: %f", sender.value); | ||
} | ||
``` | ||
If you don't need handle | ||
``` Objective-C | ||
[mySlider hideHandle]; | ||
- (void)sliderWillChangeValue:(RSSliderView *)sender; | ||
- (void)sliderDidChangeValue:(RSSliderView *)sender; | ||
``` | ||
If you don't like round corners or border | ||
|
||
## Customize Appearance | ||
``` Objective-C | ||
[mySlider removeRoundCorners:YES removeBorder:YES]; | ||
@property (nonatomic, strong) IBInspectable UIColor *backgroundColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *foregroundColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *handleColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *borderColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *textColor; | ||
@property (nonatomic, strong) IBInspectable NSString *text; | ||
@property (nonatomic, strong) IBInspectable UIFont *font; | ||
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius; | ||
@property (nonatomic, assign) IBInspectable CGFloat borderWidth; | ||
@property (nonatomic, assign) IBInspectable CGFloat handleWidth; | ||
@property (nonatomic, assign) IBInspectable CGFloat onTapAnimationSpeed; | ||
@property (nonatomic, assign, getter=isHandleHidden) IBInspectable BOOL handleHidden; | ||
@property (nonatomic, assign) RSSliderViewOrientation orientation; | ||
``` | ||
|
||
## License | ||
RSSliderView is licensed under the terms of the MIT license. Please see the [LICENSE](LICENSE) file for full details. |
Binary file removed
BIN
-29.4 KB
...xcodeproj/project.xcworkspace/xcuserdata/roman.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// | ||
// RSSliderView.h | ||
// RSSliderView | ||
// | ||
// Created by Roman Simenok on 13.02.15. | ||
// Copyright (c) 2015 Roman Simenok. All rights reserved. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@class RSSliderView; | ||
|
||
typedef NS_ENUM(NSUInteger, RSSliderViewOrientation) { | ||
RSSliderViewOrientationVertical, | ||
RSSliderViewOrientationHorizontal | ||
}; | ||
|
||
@protocol RSSliderViewDelegate <NSObject> | ||
|
||
@optional | ||
- (void)sliderWillChangeValue:(RSSliderView *)sender; | ||
- (void)sliderDidChangeValue:(RSSliderView *)sender; | ||
|
||
@end | ||
|
||
IB_DESIGNABLE | ||
@interface RSSliderView : UIView | ||
|
||
@property (nonatomic, strong) IBInspectable UIColor *foregroundColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *handleColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *borderColor; | ||
@property (nonatomic, strong) IBInspectable UIColor *textColor; | ||
|
||
/** | ||
Text in middle of the slider. | ||
*/ | ||
@property (nonatomic, strong) IBInspectable NSString *text; | ||
|
||
@property (nonatomic, strong) IBInspectable UIFont *font; | ||
|
||
/** | ||
Corner raduis, 5.0 by default. Changes affects on handle corners. | ||
*/ | ||
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius; | ||
|
||
/** | ||
2.0 by default. | ||
*/ | ||
@property (nonatomic, assign) IBInspectable CGFloat borderWidth; | ||
|
||
/** | ||
14.0 by default. | ||
*/ | ||
@property (nonatomic, assign) IBInspectable CGFloat handleWidth; | ||
|
||
/** | ||
Animation speed for On Tap Value Change. | ||
0.1 by default. | ||
*/ | ||
@property (nonatomic, assign) IBInspectable CGFloat onTapAnimationSpeed; | ||
|
||
/** | ||
No by default. | ||
*/ | ||
@property (nonatomic, assign, getter=isHandleHidden) IBInspectable BOOL handleHidden; | ||
|
||
/** | ||
Calculates from width and height automatically. | ||
*/ | ||
@property (nonatomic, assign) RSSliderViewOrientation orientation; | ||
|
||
@property (nonatomic, assign) IBInspectable CGFloat value; | ||
|
||
@property (nonatomic, weak) IBOutlet id <RSSliderViewDelegate> delegate; | ||
|
||
+ (instancetype)new NS_UNAVAILABLE; | ||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
- (void)setValue:(CGFloat)value withAnimation:(BOOL)animate; | ||
- (void)setValue:(CGFloat)value withAnimation:(BOOL)animate completion:(void (^)(BOOL finished))completion; | ||
|
||
|
||
@end |
Oops, something went wrong.