Merge branch 'JakubMazur-master'
This commit is contained in:
commit
eb5d751045
|
|
@ -49,6 +49,12 @@ Using [CocoaPods](http://cocoapods.org/?q=TGPControls)
|
|||
- **iOS 10 and later down to iOS 8**: install CocoaPods 1.2.0+ [CocoaPods-Frameworks](http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/), add `use_frameworks!` to your podfile.
|
||||
- **iOS 7**: Use TGPControls version 2.1.0
|
||||
|
||||
Using [Carthage](https://github.com/Carthage/Carthage)
|
||||
```
|
||||
github "SwiftArchitect/TGPControls"
|
||||
```
|
||||
Please note that Carthage is available only for **iOS 8 or higher**
|
||||
|
||||
Besides customization, which you can do entirely under Interface Builder in iOS 8 and later, both `TGPDiscreteSlider` and `TGPCamelLabels` require surprisingly little code to integrate.
|
||||
|
||||
### DiscreteSlider
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@
|
|||
TargetAttributes = {
|
||||
DC56BDFC1E46EA2000AAD0D9 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = 55K7THBUV8;
|
||||
LastSwiftMigration = 0820;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
|
|
@ -256,7 +255,7 @@
|
|||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 55K7THBUV8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
|
|
@ -278,7 +277,7 @@
|
|||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 55K7THBUV8;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DC56BDFC1E46EA2000AAD0D9"
|
||||
BuildableName = "TGPControls.framework"
|
||||
BlueprintName = "TGPControls"
|
||||
ReferencedContainer = "container:TGPControls.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DC56BDFC1E46EA2000AAD0D9"
|
||||
BuildableName = "TGPControls.framework"
|
||||
BlueprintName = "TGPControls"
|
||||
ReferencedContainer = "container:TGPControls.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "DC56BDFC1E46EA2000AAD0D9"
|
||||
BuildableName = "TGPControls.framework"
|
||||
BlueprintName = "TGPControls"
|
||||
ReferencedContainer = "container:TGPControls.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0</string>
|
||||
<string>3.0.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
}
|
||||
}
|
||||
|
||||
@IBInspectable public var tickImage:String? = nil {
|
||||
@IBInspectable public var tickImage:UIImage? = nil {
|
||||
didSet {
|
||||
layoutTrack()
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
}
|
||||
}
|
||||
|
||||
@IBInspectable public var trackImage:String? = nil {
|
||||
@IBInspectable public var trackImage:UIImage? = nil {
|
||||
didSet {
|
||||
layoutTrack()
|
||||
}
|
||||
|
|
@ -128,18 +128,15 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
}
|
||||
}
|
||||
|
||||
@IBInspectable public var thumbImage:String? = nil {
|
||||
@IBInspectable public var thumbImage:UIImage? = nil {
|
||||
didSet {
|
||||
// Associate image to layer NSBundle.bundleForClass(class)
|
||||
if let imageName = thumbImage,
|
||||
let image = UIImage(named: imageName) {
|
||||
thumbLayer.contents = image.cgImage
|
||||
if let thumbImage = thumbImage {
|
||||
thumbLayer.contents = thumbImage.cgImage
|
||||
}
|
||||
|
||||
layoutTrack()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@IBInspectable public var thumbShadowRadius:CGFloat = 0 {
|
||||
didSet {
|
||||
layoutTrack()
|
||||
|
|
@ -339,8 +336,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
|
||||
case .image:
|
||||
// Draw image if exists
|
||||
if let tickImage = tickImage,
|
||||
let image = UIImage(named: tickImage),
|
||||
if let image = tickImage,
|
||||
let cgImage = image.cgImage,
|
||||
let ctx = UIGraphicsGetCurrentContext() {
|
||||
let centered = CGRect(x: rectangle.origin.x + (rectangle.width/2) - (image.size.width/2),
|
||||
|
|
@ -392,8 +388,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
trackLayer.frame = CGRect.zero
|
||||
|
||||
// Draw image if exists
|
||||
if let trackImage = trackImage,
|
||||
let image = UIImage(named: trackImage),
|
||||
if let image = trackImage,
|
||||
let cgImage = image.cgImage,
|
||||
let ctx = UIGraphicsGetCurrentContext() {
|
||||
let centered = CGRect(x: (frame.width/2) - (image.size.width/2),
|
||||
|
|
@ -531,8 +526,7 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
var trackSize = CGSize(width: frame.width - thumbWidth,
|
||||
height: trackHeight)
|
||||
if(.image == trackComponentStyle) {
|
||||
if let trackImage = trackImage,
|
||||
let image = UIImage(named: trackImage) {
|
||||
if let image = trackImage {
|
||||
trackSize.width = image.size.width - thumbWidth
|
||||
}
|
||||
}
|
||||
|
|
@ -593,9 +587,8 @@ public class TGPDiscreteSlider:TGPSlider_INTERFACE_BUILDER {
|
|||
+ (iOSThumbShadowOffset.height * 2))
|
||||
|
||||
case .image:
|
||||
if let thumbImage = thumbImage,
|
||||
let image = UIImage(named: thumbImage) {
|
||||
return image.size
|
||||
if let thumbImage = thumbImage {
|
||||
return thumbImage.size
|
||||
}
|
||||
fallthrough
|
||||
|
||||
|
|
|
|||
|
|
@ -134,9 +134,9 @@
|
|||
<userDefinedRuntimeAttribute type="number" keyPath="incrementValue">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="thumbImage" value="thumb"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="tickImage" value="tick"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="trackImage" value="track"/>
|
||||
<userDefinedRuntimeAttribute type="image" keyPath="trackImage" value="track"/>
|
||||
<userDefinedRuntimeAttribute type="image" keyPath="tickImage" value="tick"/>
|
||||
<userDefinedRuntimeAttribute type="image" keyPath="thumbImage" value="thumb"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jca-ht-ahJ" userLabel="pictureLabels" customClass="TGPCamelLabels" customModule="TGPControls">
|
||||
|
|
@ -374,7 +374,7 @@
|
|||
<color key="value" red="0.40000000600000002" green="0.80000001190000003" blue="1" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="thumbShadowRadius">
|
||||
<real key="value" value="4"/>
|
||||
<real key="value" value="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="thumbShadowOffset">
|
||||
<size key="value" width="0.0" height="0.0"/>
|
||||
|
|
@ -501,4 +501,9 @@
|
|||
<point key="canvasLocation" x="344.5" y="332.5"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="thumb" width="11" height="11"/>
|
||||
<image name="tick" width="2" height="7"/>
|
||||
<image name="track" width="300" height="21"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
|||
Loading…
Reference in New Issue