Release 1.0.0

This commit is contained in:
Giuseppe Nucifora 2015-10-29 01:04:32 +01:00
parent 5ecc0d4203
commit 40cdd4eb91
111 changed files with 5910 additions and 1769 deletions

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "checkBox.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "checkBox@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "checkBox@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "checkBoxSelected.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "checkBoxSelected@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "checkBoxSelected@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,7 +1,11 @@
PODS:
- pop (1.0.7)
- PureLayout (3.0.0)
- TabBarPicker (0.3.0)
- pop (1.0.8)
- PureLayout (3.0.1)
- TabBarPicker (0.3.0):
- PureLayout
- UIActionSheet-Blocks
- UIAlertViewBlockExtension
- UIView-Overlay
- UIActionSheet-Blocks (1.0.1)
- UIAlertViewBlockExtension (1.0.1)
- UIView-Overlay (0.1)
@ -16,14 +20,14 @@ DEPENDENCIES:
EXTERNAL SOURCES:
TabBarPicker:
:path: ../
:path: "../"
SPEC CHECKSUMS:
pop: 628ffc631644601567ee8bfaaaea493ebd7d0923
PureLayout: 270dfee2236f697ab1d5e2771c2e5c248495fa0d
TabBarPicker: 4f6e765ac6ee7b07ef46ac3f98e6d5ec0999d847
pop: bb773ae2c791ca2629de13b347e7a8b450fa6a57
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
TabBarPicker: 67402456b73594ea28a59fb4fb726c5ef3057090
UIActionSheet-Blocks: a5781709d4c7e1bf81e0498caf187ab0535e5caf
UIAlertViewBlockExtension: b4b0a1e62c94170bacce519a2b16afbc81673714
UIView-Overlay: 95e42e733f6fdcfca523a399ba7907d0ca4570a0
COCOAPODS: 0.38.2
COCOAPODS: 0.39.0

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/Vendor/AADatePicker/AADatePicker.h

View File

@ -0,0 +1 @@
../../../../../Pod/Classes/Vendor/TouchableScrollView/ToucheableScrollView.h

View File

@ -20,5 +20,19 @@
"TabBarPicker": [
"Pod/Assets/*.png"
]
},
"dependencies": {
"PureLayout": [
],
"UIView-Overlay": [
],
"UIActionSheet-Blocks": [
],
"UIAlertViewBlockExtension": [
]
}
}

View File

@ -1,7 +1,11 @@
PODS:
- pop (1.0.7)
- PureLayout (3.0.0)
- TabBarPicker (0.3.0)
- pop (1.0.8)
- PureLayout (3.0.1)
- TabBarPicker (0.3.0):
- PureLayout
- UIActionSheet-Blocks
- UIAlertViewBlockExtension
- UIView-Overlay
- UIActionSheet-Blocks (1.0.1)
- UIAlertViewBlockExtension (1.0.1)
- UIView-Overlay (0.1)
@ -16,14 +20,14 @@ DEPENDENCIES:
EXTERNAL SOURCES:
TabBarPicker:
:path: ../
:path: "../"
SPEC CHECKSUMS:
pop: 628ffc631644601567ee8bfaaaea493ebd7d0923
PureLayout: 270dfee2236f697ab1d5e2771c2e5c248495fa0d
TabBarPicker: 4f6e765ac6ee7b07ef46ac3f98e6d5ec0999d847
pop: bb773ae2c791ca2629de13b347e7a8b450fa6a57
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
TabBarPicker: 67402456b73594ea28a59fb4fb726c5ef3057090
UIActionSheet-Blocks: a5781709d4c7e1bf81e0498caf187ab0535e5caf
UIAlertViewBlockExtension: b4b0a1e62c94170bacce519a2b16afbc81673714
UIView-Overlay: 95e42e733f6fdcfca523a399ba7907d0ca4570a0
COCOAPODS: 0.38.2
COCOAPODS: 0.39.0

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,30 +23,42 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1DAA46C7CBB0FB9B92A7891"
BuildableName = "TabBarPicker.bundle"
BlueprintName = "Pods-TabBarPicker_Example-TabBarPicker-TabBarPicker"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,30 +23,42 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FD042F8BAEE7119C1EA51707"
BuildableName = "TabBarPicker.framework"
BlueprintName = "Pods-TabBarPicker_Example-TabBarPicker"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,30 +23,42 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AFD4CD498974811C4E61A02F"
BuildableName = "TabBarPicker.bundle"
BlueprintName = "Pods-TabBarPicker_Tests-TabBarPicker-TabBarPicker"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0640"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,30 +23,42 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B372419045A1236C95998EEE"
BuildableName = "TabBarPicker.framework"
BlueprintName = "Pods-TabBarPicker_Tests-TabBarPicker"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D265D41209EDF436B6B579C1"
BlueprintIdentifier = "BD7FB1492BD1E0AE4ACA126CFCD5A5D6"
BuildableName = "TabBarPicker.framework"
BlueprintName = "TabBarPicker"
ReferencedContainer = "container:Pods.xcodeproj">
@ -23,33 +23,42 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<AdditionalOptions>
</AdditionalOptions>
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BD7FB1492BD1E0AE4ACA126CFCD5A5D6"
BuildableName = "TabBarPicker.framework"
BlueprintName = "TabBarPicker"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction

View File

@ -1,6 +1,6 @@
//
// ALView+PureLayout.h
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2012 Richard Turton
// Copyright (c) 2013-2015 Tyler Fox

View File

@ -1,6 +1,6 @@
//
// ALView+PureLayout.m
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2012 Richard Turton
// Copyright (c) 2013-2015 Tyler Fox

View File

@ -1,6 +1,6 @@
//
// NSArray+PureLayout.h
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2012 Richard Turton
// Copyright (c) 2013-2015 Tyler Fox

View File

@ -1,6 +1,6 @@
//
// NSArray+PureLayout.m
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2012 Richard Turton
// Copyright (c) 2013-2015 Tyler Fox

View File

@ -1,6 +1,6 @@
//
// NSLayoutConstraint+PureLayout.h
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2013-2015 Tyler Fox
//

View File

@ -1,6 +1,6 @@
//
// NSLayoutConstraint+PureLayout.m
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2013-2015 Tyler Fox
//

View File

@ -1,6 +1,6 @@
//
// PureLayout+Internal.h
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2014-2015 Tyler Fox
//

View File

@ -1,6 +1,6 @@
//
// PureLayout.h
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2014-2015 Tyler Fox
//

View File

@ -1,6 +1,6 @@
//
// PureLayoutDefines.h
// https://github.com/smileyborg/PureLayout
// https://github.com/PureLayout/PureLayout
//
// Copyright (c) 2014-2015 Tyler Fox
//

View File

@ -1,5 +1,5 @@
# [![PureLayout](https://github.com/smileyborg/PureLayout/blob/master/Images/PureLayout.png?raw=true)](#)
[![Build Status](http://img.shields.io/travis/smileyborg/PureLayout.svg?style=flat)](https://travis-ci.org/smileyborg/PureLayout) [![Test Coverage](http://img.shields.io/coveralls/smileyborg/PureLayout.svg?style=flat)](https://coveralls.io/r/smileyborg/PureLayout) [![Version](http://img.shields.io/cocoapods/v/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![Platform](http://img.shields.io/cocoapods/p/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![License](http://img.shields.io/cocoapods/l/PureLayout.svg?style=flat)](LICENSE)
# [![PureLayout](https://github.com/PureLayout/PureLayout/blob/master/Images/PureLayout.png?raw=true)](#)
[![Build Status](http://img.shields.io/travis/PureLayout/PureLayout.svg?style=flat)](https://travis-ci.org/PureLayout/PureLayout) [![Test Coverage](http://img.shields.io/coveralls/PureLayout/PureLayout.svg?style=flat)](https://coveralls.io/r/PureLayout/PureLayout) [![Version](http://img.shields.io/cocoapods/v/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![Platform](http://img.shields.io/cocoapods/p/PureLayout.svg?style=flat)](http://cocoapods.org/?q=PureLayout) [![License](http://img.shields.io/cocoapods/l/PureLayout.svg?style=flat)](LICENSE)
The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. PureLayout extends `UIView`/`NSView`, `NSArray`, and `NSLayoutConstraint` with a comprehensive Auto Layout API that is modeled after Apple's own frameworks. PureLayout is a cross-platform Objective-C library that works (and looks!) great in Swift. It is fully backwards-compatible with all versions of iOS and OS X that support Auto Layout.
@ -48,10 +48,10 @@ The current release of PureLayout supports all versions of iOS and OS X since th
That's it - now go write some beautiful Auto Layout code!
### Using [Carthage](https://github.com/Carthage/Carthage)
1. Add the `smileyborg/PureLayout` project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile).
1. Add the `PureLayout/PureLayout` project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile).
```ogdl
github "smileyborg/PureLayout"
github "PureLayout/PureLayout"
```
1. Run `carthage update`, then follow the [additional steps required](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add the framework into your project.
@ -71,10 +71,10 @@ That's it - now go write some beautiful Auto Layout code!
That's it - now go write some beautiful Auto Layout code!
### App Extensions
To use PureLayout in an App Extension, you need to do a bit of extra configuration to prevent usage of unavailable APIs. [Click here](https://github.com/smileyborg/PureLayout/wiki/App-Extensions) for more info.
To use PureLayout in an App Extension, you need to do a bit of extra configuration to prevent usage of unavailable APIs. [Click here](https://github.com/PureLayout/PureLayout/wiki/App-Extensions) for more info.
### Releases
Releases are tagged in the git commit history using [semantic versioning](http://semver.org). Check out the [releases and release notes](https://github.com/smileyborg/PureLayout/releases) for each version.
Releases are tagged in the git commit history using [semantic versioning](http://semver.org). Check out the [releases and release notes](https://github.com/PureLayout/PureLayout/releases) for each version.
## API Cheat Sheet
This is just a handy overview of the core API methods. Explore the [header files](PureLayout/PureLayout) for the full API, and find the complete documentation above the implementation of each method in the corresponding .m file. A couple of notes:
@ -184,7 +184,7 @@ Each demo in the iOS example app has a Swift and Objective-C version. **To compi
On OS X, while running the app, press any key to cycle through the demos. You can resize the window to see the constraints in action.
### Tips and Tricks
Check out some [Tips and Tricks](https://github.com/smileyborg/PureLayout/wiki/Tips-and-Tricks) to keep in mind when using the API.
Check out some [Tips and Tricks](https://github.com/PureLayout/PureLayout/wiki/Tips-and-Tricks) to keep in mind when using the API.
## PureLayout vs. the rest
There are quite a few different ways to implement Auto Layout. Here is a quick overview of the available options:
@ -211,9 +211,9 @@ There are quite a few different ways to implement Auto Layout. Here is a quick o
PureLayout takes a balanced approach to Auto Layout that makes it well suited for any project.
## Problems, Suggestions, Pull Requests?
Please open a [new Issue here](https://github.com/smileyborg/PureLayout/issues/new) if you run into a problem specific to PureLayout, have a feature request, or want to share a comment. Note that general Auto Layout questions should be asked on [Stack Overflow](http://stackoverflow.com).
Please open a [new Issue here](https://github.com/PureLayout/PureLayout/issues/new) if you run into a problem specific to PureLayout, have a feature request, or want to share a comment. Note that general Auto Layout questions should be asked on [Stack Overflow](http://stackoverflow.com).
Pull requests are encouraged and greatly appreciated! Please try to maintain consistency with the existing code style. If you're considering taking on significant changes or additions to the project, please communicate in advance by opening a new Issue. This allows everyone to get onboard with upcoming changes, ensures that changes align with the project's design philosophy, and avoids duplicated work.
## Meta
Designed & maintained by Tyler Fox ([@smileyborg](https://twitter.com/smileyborg)). Distributed with the MIT license.
Originally designed & built by Tyler Fox ([@smileyborg](https://github.com/smileyborg)). Currently maintained by Mickey Reiss ([@mickeyreiss](https://github.com/mickeyreiss)). Distributed with the MIT license.

View File

@ -10,8 +10,10 @@ install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
else
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
@ -25,19 +27,31 @@ install_framework()
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
@ -50,20 +64,38 @@ code_sign_if_enabled() {
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework 'Pods-TabBarPicker_Example/PureLayout.framework'
install_framework 'Pods-TabBarPicker_Example/UIActionSheet_Blocks.framework'
install_framework 'Pods-TabBarPicker_Example/UIAlertViewBlockExtension.framework'
install_framework 'Pods-TabBarPicker_Example/pop.framework'
install_framework 'Pods-TabBarPicker_Example/TabBarPicker.framework'
install_framework 'Pods-TabBarPicker_Example/UIView_Overlay.framework'
install_framework "Pods-TabBarPicker_Example/PureLayout.framework"
install_framework "Pods-TabBarPicker_Example/UIActionSheet_Blocks.framework"
install_framework "Pods-TabBarPicker_Example/UIAlertViewBlockExtension.framework"
install_framework "Pods-TabBarPicker_Example/pop.framework"
install_framework "Pods-TabBarPicker_Example/TabBarPicker.framework"
install_framework "Pods-TabBarPicker_Example/UIView_Overlay.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework 'Pods-TabBarPicker_Example/PureLayout.framework'
install_framework 'Pods-TabBarPicker_Example/UIActionSheet_Blocks.framework'
install_framework 'Pods-TabBarPicker_Example/UIAlertViewBlockExtension.framework'
install_framework 'Pods-TabBarPicker_Example/pop.framework'
install_framework 'Pods-TabBarPicker_Example/TabBarPicker.framework'
install_framework 'Pods-TabBarPicker_Example/UIView_Overlay.framework'
install_framework "Pods-TabBarPicker_Example/PureLayout.framework"
install_framework "Pods-TabBarPicker_Example/UIActionSheet_Blocks.framework"
install_framework "Pods-TabBarPicker_Example/UIAlertViewBlockExtension.framework"
install_framework "Pods-TabBarPicker_Example/pop.framework"
install_framework "Pods-TabBarPicker_Example/TabBarPicker.framework"
install_framework "Pods-TabBarPicker_Example/UIView_Overlay.framework"
fi

View File

@ -60,7 +60,7 @@ install_resource()
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]]; then
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

View File

@ -1,5 +1,3 @@
CLANG_CXX_LANGUAGE_STANDARD = c++11
CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/TabBarPicker.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIActionSheet_Blocks.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIAlertViewBlockExtension.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIView_Overlay.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/pop.framework/Headers"

View File

@ -1,5 +1,3 @@
CLANG_CXX_LANGUAGE_STANDARD = c++11
CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/TabBarPicker.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIActionSheet_Blocks.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIAlertViewBlockExtension.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIView_Overlay.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/pop.framework/Headers"

View File

@ -1,6 +1,55 @@
# Acknowledgements
This application makes use of the following third party libraries:
## PureLayout
This code is distributed under the terms and conditions of the MIT license.
Copyright (c) 2014-2015 Tyler Fox
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.
## UIActionSheet-Blocks
Copyright (C) 2013 Developed by Shai Mishali
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.
## UIAlertViewBlockExtension
The MIT License (MIT)
Copyright (c) 2015 mangofever
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.
## TabBarPicker
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
@ -23,4 +72,30 @@ 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.
## UIView-Overlay
The MIT License (MIT)
Copyright (c) 2015 lanserxt
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.
Generated by CocoaPods - http://cocoapods.org

View File

@ -12,6 +12,67 @@
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>This code is distributed under the terms and conditions of the MIT license.
Copyright (c) 2014-2015 Tyler Fox
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.
</string>
<key>Title</key>
<string>PureLayout</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (C) 2013 Developed by Shai Mishali
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.
</string>
<key>Title</key>
<string>UIActionSheet-Blocks</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>The MIT License (MIT)
Copyright (c) 2015 mangofever
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.
</string>
<key>Title</key>
<string>UIAlertViewBlockExtension</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2015 Giuseppe Nucifora &lt;me@giuseppenucifora.com&gt;
@ -39,6 +100,36 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>The MIT License (MIT)
Copyright (c) 2015 lanserxt
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.
</string>
<key>Title</key>
<string>UIView-Overlay</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>

View File

@ -10,8 +10,10 @@ install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
else
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
@ -25,19 +27,31 @@ install_framework()
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
@ -50,10 +64,36 @@ code_sign_if_enabled() {
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework 'Pods-TabBarPicker_Tests/TabBarPicker.framework'
install_framework "Pods-TabBarPicker_Tests/PureLayout.framework"
install_framework "Pods-TabBarPicker_Tests/UIActionSheet_Blocks.framework"
install_framework "Pods-TabBarPicker_Tests/UIAlertViewBlockExtension.framework"
install_framework "Pods-TabBarPicker_Tests/TabBarPicker.framework"
install_framework "Pods-TabBarPicker_Tests/UIView_Overlay.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework 'Pods-TabBarPicker_Tests/TabBarPicker.framework'
install_framework "Pods-TabBarPicker_Tests/PureLayout.framework"
install_framework "Pods-TabBarPicker_Tests/UIActionSheet_Blocks.framework"
install_framework "Pods-TabBarPicker_Tests/UIAlertViewBlockExtension.framework"
install_framework "Pods-TabBarPicker_Tests/TabBarPicker.framework"
install_framework "Pods-TabBarPicker_Tests/UIView_Overlay.framework"
fi

View File

@ -60,7 +60,7 @@ install_resource()
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]]; then
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

View File

@ -1,6 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/TabBarPicker.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "TabBarPicker"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/TabBarPicker.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIActionSheet_Blocks.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIAlertViewBlockExtension.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIView_Overlay.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PureLayout" -framework "TabBarPicker" -framework "UIActionSheet_Blocks" -framework "UIAlertViewBlockExtension" -framework "UIView_Overlay"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-TabBarPicker_Tests
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,6 +1,6 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/TabBarPicker.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "TabBarPicker"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/TabBarPicker.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIActionSheet_Blocks.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIAlertViewBlockExtension.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIView_Overlay.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PureLayout" -framework "TabBarPicker" -framework "UIActionSheet_Blocks" -framework "UIAlertViewBlockExtension" -framework "UIView_Overlay"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-TabBarPicker_Tests
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -10,8 +10,10 @@ install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
else
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
@ -25,19 +27,31 @@ install_framework()
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
@ -50,16 +64,34 @@ code_sign_if_enabled() {
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework 'Pods/PureLayout.framework'
install_framework 'Pods/UIActionSheet_Blocks.framework'
install_framework 'Pods/UIAlertViewBlockExtension.framework'
install_framework 'Pods/pop.framework'
install_framework "Pods/PureLayout.framework"
install_framework "Pods/UIActionSheet_Blocks.framework"
install_framework "Pods/UIAlertViewBlockExtension.framework"
install_framework "Pods/pop.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework 'Pods/PureLayout.framework'
install_framework 'Pods/UIActionSheet_Blocks.framework'
install_framework 'Pods/UIAlertViewBlockExtension.framework'
install_framework 'Pods/pop.framework'
install_framework "Pods/PureLayout.framework"
install_framework "Pods/UIActionSheet_Blocks.framework"
install_framework "Pods/UIAlertViewBlockExtension.framework"
install_framework "Pods/pop.framework"
fi

View File

@ -60,7 +60,7 @@ install_resource()
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]]; then
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

View File

@ -1,5 +1,3 @@
CLANG_CXX_LANGUAGE_STANDARD = c++11
CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIActionSheet_Blocks.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIAlertViewBlockExtension.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/pop.framework/Headers"

View File

@ -1,5 +1,3 @@
CLANG_CXX_LANGUAGE_STANDARD = c++11
CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIActionSheet_Blocks.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIAlertViewBlockExtension.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/pop.framework/Headers"

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<string>3.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -1,5 +0,0 @@
#include "PureLayout.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PureLayout" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -0,0 +1,4 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PureLayout" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -1,5 +0,0 @@
#include "TabBarPicker.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/TabBarPicker" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -4,9 +4,11 @@
#import "TabBarPicker.h"
#import "TabBarPickerSubItemsView.h"
#import "TabBarSubItem.h"
#import "AADatePicker.h"
#import "MMCPSScrollView.h"
#import "NSString+HexColor.h"
#import "SharedLocationManager.h"
#import "ToucheableScrollView.h"
#import "UIButton+BackgroundColor.h"
#import "UIImage+Color.h"

View File

@ -0,0 +1,4 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/TabBarPicker" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -1,5 +0,0 @@
#include "UIActionSheet-Blocks.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIActionSheet-Blocks" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -0,0 +1,4 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIActionSheet-Blocks" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -1,5 +0,0 @@
#include "UIAlertViewBlockExtension.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIAlertViewBlockExtension" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -0,0 +1,4 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIAlertViewBlockExtension" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -1,5 +0,0 @@
#include "UIView-Overlay.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIView-Overlay" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -0,0 +1,4 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/UIView-Overlay" "${PODS_ROOT}/Headers/Public"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.7</string>
<string>1.0.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -1,8 +0,0 @@
#include "pop.xcconfig"
CLANG_CXX_LANGUAGE_STANDARD = ${POP_CLANG_CXX_LANGUAGE_STANDARD}
CLANG_CXX_LIBRARY = ${POP_CLANG_CXX_LIBRARY}
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/pop" "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = ${POP_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -1,3 +1,7 @@
POP_CLANG_CXX_LANGUAGE_STANDARD = c++11
POP_CLANG_CXX_LIBRARY = libc++
POP_OTHER_LDFLAGS = -l"c++"
CLANG_CXX_LANGUAGE_STANDARD = c++11
CLANG_CXX_LIBRARY = libc++
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/pop" "${PODS_ROOT}/Headers/Public"
OTHER_LDFLAGS = -l"c++"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES

View File

@ -11,6 +11,25 @@ Pop is available on [CocoaPods](http://cocoapods.org). Just add the following to
```ruby
pod 'pop', '~> 1.0'
```
Bugs are first fixed in master and then made available via a designated release. If you tend to live on the bleeding edge, you can use Pop from master with the following Podfile entry:
```ruby
pod 'pop', :git => 'https://github.com/facebook/pop.git'
```
## Non-CocoaPods Installation
### iOS 8 Embedded Framework
By adding the project to your project and adding pop.embedded framework to the Embedded Binaries section on the General tab of your app's target, you can set up pop in seconds! This also enables `@import pop` syntax with header modules.
**Note**: because of some awkward limitations with Xcode, embedded binaries must share the same name as the module and must have `.framework` as an extension. This means that you'll see two pop.frameworks when adding embedded binaries (one for OS X, and one for iOS). You'll need to be sure to add the iOS one, and since this list is populated in order of targets, it's safe to assume it's the second one. You can verify the correct one was chosen by checking the path next to the framework listed: `Debug-iphoneos`.
![Embedded Binaries](Images/EmbeddedBinaries.png?raw=true)
**Note 2**: this method does not currently play nicely with workspaces. For some unknown reason, Xcode simply rejects adding pop.framework as an embedded binary when pop.xcodeproj is placed in the workspace. This only works when pop.xcodeproj is added as a subproject to the current target's project.
### Advanced
Alternatively, you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including `-lc++` to your project linker flags.
## Usage
@ -21,6 +40,12 @@ Pop adopts the Core Animation explicit animation programming model. Use by inclu
#import <pop/POP.h>
```
or if you're using the embedded framework:
```objective-c
@import pop;
```
### Start, Stop & Update
To start an animation, add it to the object you wish to animate:
@ -143,15 +168,22 @@ pod install
Assuming CocoaPods is installed, this will include the necessary OCMock dependency to the unit test targets.
## SceneKit
Due to SceneKit requiring iOS 8 and OS X 10.9, POP's SceneKit extensions aren't provided out of box. Unfortunately, [weakly linked frameworks](https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html) cannot be used due to issues mentioned in the [Xcode 6.1 Release Notes](https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html).
To remedy this, you can easily opt-in to use SceneKit! Simply add this to the Preprocessor Macros section of your Xcode Project:
```
POP_USE_SCENEKIT=1
```
## Resources
A collection of links to external resources that may prove valuable:
* [AGGeometryKit+POP - Animating Quadrilaterals with Pop](https://github.com/hfossli/aggeometrykit-pop)
* [Apple Core Animation Programming Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html)
* [Codeplease Bridging the gesture to animation gap](http://codeplease.io/playing-with-pop-ii/)
* [Codeplease Playing with Pop (iii)](http://codeplease.io/playing-with-pop-iii/)
* [Codeplease Adding a custom animatable property](http://codeplease.io/playing-with-pop-v/)
* [iOS Development Tips UIScrollView-like deceleration with Pop](http://iosdevtips.co/post/84571595353/replicating-uiscrollviews-deceleration-with-facebook)
* [Pop Playground Repository of Pop animation examples](https://github.com/callmeed/pop-playground)
* [Pop Playground 2 Playing with Facebook's framework](http://victorbaro.com/2014/05/pop-playground-playing-with-facebooks-framework/)
@ -161,6 +193,7 @@ A collection of links to external resources that may prove valuable:
* [Tapity Tutorial Getting Started with Pop](http://tapity.com/tutorial-getting-started-with-pop/)
* [Tweaks Easily adjust parameters for iOS apps in development](https://github.com/facebook/tweaks)
* [POP Tutorial in 5 steps](https://github.com/maxmyers/FacebookPop)
* [VBFPopFlatButton Flat animatable button, using Pop to transition between states](https://github.com/victorBaro/VBFPopFlatButton)
## Contributing
See the CONTRIBUTING file for how to help out.

View File

@ -10,6 +10,8 @@
#ifndef POP_POP_H
#define POP_POP_H
#import <pop/POPDefines.h>
#import <pop/POPAnimatableProperty.h>
#import <pop/POPAnimation.h>
#import <pop/POPAnimationEvent.h>
@ -19,10 +21,9 @@
#import <pop/POPBasicAnimation.h>
#import <pop/POPCustomAnimation.h>
#import <pop/POPDecayAnimation.h>
#import <pop/POPDefines.h>
#import <pop/POPGeometry.h>
#import <pop/POPLayerExtras.h>
#import <pop/POPPropertyAnimation.h>
#import <pop/POPSpringAnimation.h>
#endif /* POP_POP_H */

View File

@ -11,6 +11,7 @@
#define POPACTION_H
#import <QuartzCore/CATransaction.h>
#import <pop/POPDefines.h>
#ifdef __cplusplus

View File

@ -8,8 +8,11 @@
*/
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/NSObject.h>
#import <pop/POPDefines.h>
@class POPMutableAnimatableProperty;
/**
@ -125,6 +128,7 @@ extern NSString * const kPOPShapeLayerStrokeStart;
extern NSString * const kPOPShapeLayerStrokeEnd;
extern NSString * const kPOPShapeLayerStrokeColor;
extern NSString * const kPOPShapeLayerFillColor;
extern NSString * const kPOPShapeLayerLineWidth;
/**
Common NSLayoutConstraint property names.
@ -188,4 +192,58 @@ extern NSString * const kPOPTabBarBarTintColor;
*/
extern NSString * const kPOPLabelTextColor;
#else
/**
Common NSView property names.
*/
extern NSString * const kPOPViewFrame;
extern NSString * const kPOPViewBounds;
extern NSString * const kPOPViewAlphaValue;
extern NSString * const kPOPViewFrameRotation;
extern NSString * const kPOPViewFrameCenterRotation;
extern NSString * const kPOPViewBoundsRotation;
/**
Common NSWindow property names.
*/
extern NSString * const kPOPWindowFrame;
extern NSString * const kPOPWindowAlphaValue;
extern NSString * const kPOPWindowBackgroundColor;
#endif
#if SCENEKIT_SDK_AVAILABLE
/**
Common SceneKit property names.
*/
extern NSString * const kPOPSCNNodePosition;
extern NSString * const kPOPSCNNodePositionX;
extern NSString * const kPOPSCNNodePositionY;
extern NSString * const kPOPSCNNodePositionZ;
extern NSString * const kPOPSCNNodeTranslation;
extern NSString * const kPOPSCNNodeTranslationX;
extern NSString * const kPOPSCNNodeTranslationY;
extern NSString * const kPOPSCNNodeTranslationZ;
extern NSString * const kPOPSCNNodeRotation;
extern NSString * const kPOPSCNNodeRotationX;
extern NSString * const kPOPSCNNodeRotationY;
extern NSString * const kPOPSCNNodeRotationZ;
extern NSString * const kPOPSCNNodeRotationW;
extern NSString * const kPOPSCNNodeEulerAngles;
extern NSString * const kPOPSCNNodeEulerAnglesX;
extern NSString * const kPOPSCNNodeEulerAnglesY;
extern NSString * const kPOPSCNNodeEulerAnglesZ;
extern NSString * const kPOPSCNNodeOrientation;
extern NSString * const kPOPSCNNodeOrientationX;
extern NSString * const kPOPSCNNodeOrientationY;
extern NSString * const kPOPSCNNodeOrientationZ;
extern NSString * const kPOPSCNNodeOrientationW;
extern NSString * const kPOPSCNNodeScale;
extern NSString * const kPOPSCNNodeScaleX;
extern NSString * const kPOPSCNNodeScaleY;
extern NSString * const kPOPSCNNodeScaleZ;
extern NSString * const kPOPSCNNodeScaleXY;
#endif

View File

@ -8,18 +8,13 @@
*/
#import "POPAnimatableProperty.h"
#import "POPCGUtils.h"
#import "POPAnimationRuntime.h"
#import <QuartzCore/QuartzCore.h>
#import <pop/POPLayerExtras.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#else
#import <AppKit/NSLayoutConstraint.h>
#endif
#import "POPAnimationRuntime.h"
#import "POPCGUtils.h"
#import "POPDefines.h"
#import "POPLayerExtras.h"
// common threshold definitions
static CGFloat const kPOPThresholdColor = 0.01;
@ -68,10 +63,13 @@ NSString * const kPOPShapeLayerStrokeStart = @"shapeLayer.strokeStart";
NSString * const kPOPShapeLayerStrokeEnd = @"shapeLayer.strokeEnd";
NSString * const kPOPShapeLayerStrokeColor = @"shapeLayer.strokeColor";
NSString * const kPOPShapeLayerFillColor = @"shapeLayer.fillColor";
NSString * const kPOPShapeLayerLineWidth = @"shapeLayer.lineWidth";
// NSLayoutConstraint
NSString * const kPOPLayoutConstraintConstant = @"layoutConstraint.constant";
#if TARGET_OS_IPHONE
// UIView
NSString * const kPOPViewAlpha = @"view.alpha";
NSString * const kPOPViewBackgroundColor = @"view.backgroundColor";
@ -107,9 +105,59 @@ NSString * const kPOPToolbarBarTintColor = kPOPNavigationBarBarTintColor;
// UITabBar
NSString * const kPOPTabBarBarTintColor = kPOPNavigationBarBarTintColor;
//UILabel
// UILabel
NSString * const kPOPLabelTextColor = @"label.textColor";
#else
// NSView
NSString * const kPOPViewFrame = @"view.frame";
NSString * const kPOPViewBounds = @"view.bounds";
NSString * const kPOPViewAlphaValue = @"view.alphaValue";
NSString * const kPOPViewFrameRotation = @"view.frameRotation";
NSString * const kPOPViewFrameCenterRotation = @"view.frameCenterRotation";
NSString * const kPOPViewBoundsRotation = @"view.boundsRotation";
// NSWindow
NSString * const kPOPWindowFrame = @"window.frame";
NSString * const kPOPWindowAlphaValue = @"window.alphaValue";
NSString * const kPOPWindowBackgroundColor = @"window.backgroundColor";
#endif
#if SCENEKIT_SDK_AVAILABLE
// SceneKit
NSString * const kPOPSCNNodePosition = @"scnode.position";
NSString * const kPOPSCNNodePositionX = @"scnnode.position.x";
NSString * const kPOPSCNNodePositionY = @"scnnode.position.y";
NSString * const kPOPSCNNodePositionZ = @"scnnode.position.z";
NSString * const kPOPSCNNodeTranslation = @"scnnode.translation";
NSString * const kPOPSCNNodeTranslationX = @"scnnode.translation.x";
NSString * const kPOPSCNNodeTranslationY = @"scnnode.translation.y";
NSString * const kPOPSCNNodeTranslationZ = @"scnnode.translation.z";
NSString * const kPOPSCNNodeRotation = @"scnnode.rotation";
NSString * const kPOPSCNNodeRotationX = @"scnnode.rotation.x";
NSString * const kPOPSCNNodeRotationY = @"scnnode.rotation.y";
NSString * const kPOPSCNNodeRotationZ = @"scnnode.rotation.z";
NSString * const kPOPSCNNodeRotationW = @"scnnode.rotation.w";
NSString * const kPOPSCNNodeEulerAngles = @"scnnode.eulerAngles";
NSString * const kPOPSCNNodeEulerAnglesX = @"scnnode.eulerAngles.x";
NSString * const kPOPSCNNodeEulerAnglesY = @"scnnode.eulerAngles.y";
NSString * const kPOPSCNNodeEulerAnglesZ = @"scnnode.eulerAngles.z";
NSString * const kPOPSCNNodeOrientation = @"scnnode.orientation";
NSString * const kPOPSCNNodeOrientationX = @"scnnode.orientation.x";
NSString * const kPOPSCNNodeOrientationY = @"scnnode.orientation.y";
NSString * const kPOPSCNNodeOrientationZ = @"scnnode.orientation.z";
NSString * const kPOPSCNNodeOrientationW = @"scnnode.orientation.w";
NSString * const kPOPSCNNodeScale = @"scnnode.scale";
NSString * const kPOPSCNNodeScaleX = @"scnnode.scale.x";
NSString * const kPOPSCNNodeScaleY = @"scnnode.scale.y";
NSString * const kPOPSCNNodeScaleZ = @"scnnode.scale.z";
NSString * const kPOPSCNNodeScaleXY = @"scnnode.scale.xy";
#endif
/**
State structure internal to static animatable property.
*/
@ -489,6 +537,16 @@ static POPStaticAnimatablePropertyState _staticStates[] =
kPOPThresholdColor
},
{kPOPShapeLayerLineWidth,
^(CAShapeLayer *obj, CGFloat values[]) {
values[0] = obj.lineWidth;
},
^(CAShapeLayer *obj, const CGFloat values[]) {
obj.lineWidth = values[0];
},
0.01
},
{kPOPLayoutConstraintConstant,
^(NSLayoutConstraint *obj, CGFloat values[]) {
values[0] = obj.constant;
@ -652,6 +710,381 @@ static POPStaticAnimatablePropertyState _staticStates[] =
kPOPThresholdColor
},
#else
/* NSView */
{kPOPViewFrame,
^(NSView *obj, CGFloat values[]) {
values_from_rect(values, NSRectToCGRect(obj.frame));
},
^(NSView *obj, const CGFloat values[]) {
obj.frame = NSRectFromCGRect(values_to_rect(values));
},
kPOPThresholdPoint
},
{kPOPViewBounds,
^(NSView *obj, CGFloat values[]) {
values_from_rect(values, NSRectToCGRect(obj.frame));
},
^(NSView *obj, const CGFloat values[]) {
obj.bounds = NSRectFromCGRect(values_to_rect(values));
},
kPOPThresholdPoint
},
{kPOPViewAlphaValue,
^(NSView *obj, CGFloat values[]) {
values[0] = obj.alphaValue;
},
^(NSView *obj, const CGFloat values[]) {
obj.alphaValue = values[0];
},
kPOPThresholdOpacity
},
{kPOPViewFrameRotation,
^(NSView *obj, CGFloat values[]) {
values[0] = obj.frameRotation;
},
^(NSView *obj, const CGFloat values[]) {
obj.frameRotation = values[0];
},
kPOPThresholdRotation
},
{kPOPViewFrameCenterRotation,
^(NSView *obj, CGFloat values[]) {
values[0] = obj.frameCenterRotation;
},
^(NSView *obj, const CGFloat values[]) {
obj.frameCenterRotation = values[0];
},
kPOPThresholdRotation
},
{kPOPViewBoundsRotation,
^(NSView *obj, CGFloat values[]) {
values[0] = obj.boundsRotation;
},
^(NSView *obj, const CGFloat values[]) {
obj.boundsRotation = values[0];
},
kPOPThresholdRotation
},
/* NSWindow */
{kPOPWindowFrame,
^(NSWindow *obj, CGFloat values[]) {
values_from_rect(values, NSRectToCGRect(obj.frame));
},
^(NSWindow *obj, const CGFloat values[]) {
[obj setFrame:NSRectFromCGRect(values_to_rect(values)) display:YES];
},
kPOPThresholdPoint
},
{kPOPWindowAlphaValue,
^(NSWindow *obj, CGFloat values[]) {
values[0] = obj.alphaValue;
},
^(NSWindow *obj, const CGFloat values[]) {
obj.alphaValue = values[0];
},
kPOPThresholdOpacity
},
{kPOPWindowBackgroundColor,
^(NSWindow *obj, CGFloat values[]) {
POPNSColorGetRGBAComponents(obj.backgroundColor, values);
},
^(NSWindow *obj, const CGFloat values[]) {
obj.backgroundColor = POPNSColorRGBACreate(values);
},
kPOPThresholdColor
},
#endif
#if SCENEKIT_SDK_AVAILABLE
/* SceneKit */
{kPOPSCNNodePosition,
^(SCNNode *obj, CGFloat values[]) {
values_from_vec3(values, obj.position);
},
^(SCNNode *obj, const CGFloat values[]) {
obj.position = values_to_vec3(values);
},
kPOPThresholdScale
},
{kPOPSCNNodePositionX,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.position.x;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.position = SCNVector3Make(values[0], obj.position.y, obj.position.z);
},
kPOPThresholdScale
},
{kPOPSCNNodePositionY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.position.y;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.position = SCNVector3Make(obj.position.x, values[0], obj.position.z);
},
kPOPThresholdScale
},
{kPOPSCNNodePositionZ,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.position.z;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.position = SCNVector3Make(obj.position.x, obj.position.y, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeTranslation,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.transform.m41;
values[1] = obj.transform.m42;
values[2] = obj.transform.m43;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.transform = SCNMatrix4MakeTranslation(values[0], values[1], values[2]);
},
kPOPThresholdScale
},
{kPOPSCNNodeTranslationX,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.transform.m41;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.transform = SCNMatrix4MakeTranslation(values[0], obj.transform.m42, obj.transform.m43);
},
kPOPThresholdScale
},
{kPOPSCNNodeTranslationY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.transform.m42;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.transform = SCNMatrix4MakeTranslation(obj.transform.m41, values[0], obj.transform.m43);
},
kPOPThresholdScale
},
{kPOPSCNNodeTranslationY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.transform.m43;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.transform = SCNMatrix4MakeTranslation(obj.transform.m41, obj.transform.m42, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeRotation,
^(SCNNode *obj, CGFloat values[]) {
values_from_vec4(values, obj.rotation);
},
^(SCNNode *obj, const CGFloat values[]) {
obj.rotation = values_to_vec4(values);
},
kPOPThresholdScale
},
{kPOPSCNNodeRotationX,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.rotation.x;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.rotation = SCNVector4Make(1.0, obj.rotation.y, obj.rotation.z, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeRotationY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.rotation.y;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.rotation = SCNVector4Make(obj.rotation.x, 1.0, obj.rotation.z, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeRotationZ,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.rotation.z;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.rotation = SCNVector4Make(obj.rotation.x, obj.rotation.y, 1.0, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeRotationW,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.rotation.w;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.rotation = SCNVector4Make(obj.rotation.x, obj.rotation.y, obj.rotation.z, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeEulerAngles,
^(SCNNode *obj, CGFloat values[]) {
values_from_vec3(values, obj.eulerAngles);
},
^(SCNNode *obj, const CGFloat values[]) {
obj.eulerAngles = values_to_vec3(values);
},
kPOPThresholdScale
},
{kPOPSCNNodeEulerAnglesX,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.eulerAngles.x;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.eulerAngles = SCNVector3Make(values[0], obj.eulerAngles.y, obj.eulerAngles.z);
},
kPOPThresholdScale
},
{kPOPSCNNodeEulerAnglesY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.eulerAngles.y;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.eulerAngles = SCNVector3Make(obj.eulerAngles.x, values[0], obj.eulerAngles.z);
},
kPOPThresholdScale
},
{kPOPSCNNodeEulerAnglesZ,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.eulerAngles.z;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.eulerAngles = SCNVector3Make(obj.eulerAngles.x, obj.eulerAngles.y, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeOrientation,
^(SCNNode *obj, CGFloat values[]) {
values_from_vec4(values, obj.orientation);
},
^(SCNNode *obj, const CGFloat values[]) {
obj.orientation = values_to_vec4(values);
},
kPOPThresholdScale
},
{kPOPSCNNodeOrientationX,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.orientation.x;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.orientation = SCNVector4Make(values[0], obj.orientation.y, obj.orientation.z, obj.orientation.w);
},
kPOPThresholdScale
},
{kPOPSCNNodeOrientationY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.orientation.y;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.orientation = SCNVector4Make(obj.orientation.x, values[0], obj.orientation.z, obj.orientation.w);
},
kPOPThresholdScale
},
{kPOPSCNNodeOrientationZ,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.orientation.z;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.orientation = SCNVector4Make(obj.orientation.x, obj.orientation.y, values[0], obj.orientation.w);
},
kPOPThresholdScale
},
{kPOPSCNNodeOrientationW,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.orientation.w;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.orientation = SCNVector4Make(obj.orientation.x, obj.orientation.y, obj.orientation.z, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeScale,
^(SCNNode *obj, CGFloat values[]) {
values_from_vec3(values, obj.scale);
},
^(SCNNode *obj, const CGFloat values[]) {
obj.scale = values_to_vec3(values);
},
kPOPThresholdScale
},
{kPOPSCNNodeScaleX,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.scale.x;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.scale = SCNVector3Make(values[0], obj.scale.y, obj.scale.z);
},
kPOPThresholdScale
},
{kPOPSCNNodeScaleY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.scale.y;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.position = SCNVector3Make(obj.scale.x, values[0], obj.scale.z);
},
kPOPThresholdScale
},
{kPOPSCNNodeScaleZ,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.scale.z;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.scale = SCNVector3Make(obj.scale.x, obj.scale.y, values[0]);
},
kPOPThresholdScale
},
{kPOPSCNNodeScaleXY,
^(SCNNode *obj, CGFloat values[]) {
values[0] = obj.scale.x;
values[1] = obj.scale.y;
},
^(SCNNode *obj, const CGFloat values[]) {
obj.scale = SCNVector3Make(values[0], values[1], obj.scale.z);
},
kPOPThresholdScale
},
#endif
};

View File

@ -44,11 +44,26 @@
*/
@property (readonly, nonatomic) POPAnimationTracer *tracer;
/**
@abstract Optional block called on animation start.
*/
@property (copy, nonatomic) void (^animationDidStartBlock)(POPAnimation *anim);
/**
@abstract Optional block called when value meets or exceeds to value.
*/
@property (copy, nonatomic) void (^animationDidReachToValueBlock)(POPAnimation *anim);
/**
@abstract Optional block called on animation completion.
*/
@property (copy, nonatomic) void (^completionBlock)(POPAnimation *anim, BOOL finished);
/**
@abstract Optional block called each frame animation is applied.
*/
@property (copy, nonatomic) void (^animationDidApplyBlock)(POPAnimation *anim);
/**
@abstract Flag indicating whether animation should be removed on completion.
@discussion Setting to NO can facilitate animation reuse. Defaults to YES.
@ -160,3 +175,14 @@ When combined with the autoreverses property, a singular animation is effectivel
- (id)pop_animationForKey:(NSString *)key;
@end
/**
* This implementation of NSCopying does not do any copying of animation's state, but only configuration.
* i.e. you cannot copy an animation and expect to apply it to a view and have the copied animation pick up where the original left off.
* Two common uses of copying animations:
* * you need to apply the same animation to multiple different views.
* * you need to absolutely ensure that the the caller of your function cannot mutate the animation once it's been passed in.
*/
@interface POPAnimation (NSCopying) <NSCopying>
@end

View File

@ -7,15 +7,15 @@
of patent rights can be found in the PATENTS file in the same directory.
*/
#import "POPAnimationExtras.h"
#import "POPAnimationInternal.h"
#import "POPAnimationTracerInternal.h"
#import <objc/runtime.h>
#import "POPAnimationExtras.h"
#import "POPAnimationRuntime.h"
#import "POPAnimatorPrivate.h"
#import "POPAction.h"
#import "POPAnimationRuntime.h"
#import "POPAnimationTracerInternal.h"
#import "POPAnimatorPrivate.h"
using namespace POP;
@ -118,7 +118,10 @@ using namespace POP;
}
FB_PROPERTY_GET(POPAnimationState, type, POPAnimationType);
DEFINE_RW_PROPERTY_OBJ_COPY(POPAnimationState, animationDidStartBlock, setAnimationDidStartBlock:, POPAnimationDidStartBlock);
DEFINE_RW_PROPERTY_OBJ_COPY(POPAnimationState, animationDidReachToValueBlock, setAnimationDidReachToValueBlock:, POPAnimationDidReachToValueBlock);
DEFINE_RW_PROPERTY_OBJ_COPY(POPAnimationState, completionBlock, setCompletionBlock:, POPAnimationCompletionBlock);
DEFINE_RW_PROPERTY_OBJ_COPY(POPAnimationState, animationDidApplyBlock, setAnimationDidApplyBlock:, POPAnimationDidApplyBlock);
DEFINE_RW_PROPERTY_OBJ_COPY(POPAnimationState, name, setName:, NSString*);
DEFINE_RW_PROPERTY(POPAnimationState, beginTime, setBeginTime:, CFTimeInterval);
DEFINE_RW_FLAG(POPAnimationState, removedOnCompletion, removedOnCompletion, setRemovedOnCompletion:);
@ -267,3 +270,34 @@ POPAnimationState *POPAnimationGetState(POPAnimation *a)
}
@end
@implementation POPAnimation (NSCopying)
- (instancetype)copyWithZone:(NSZone *)zone
{
/*
* Must use [self class] instead of POPAnimation so that subclasses can call this via super.
* Even though POPAnimation and POPPropertyAnimation throw exceptions on init,
* it's safe to call it since you can only copy objects that have been successfully created.
*/
POPAnimation *copy = [[[self class] allocWithZone:zone] init];
if (copy) {
copy.name = self.name;
copy.beginTime = self.beginTime;
copy.delegate = self.delegate;
copy.animationDidStartBlock = self.animationDidStartBlock;
copy.animationDidReachToValueBlock = self.animationDidReachToValueBlock;
copy.completionBlock = self.completionBlock;
copy.animationDidApplyBlock = self.animationDidApplyBlock;
copy.removedOnCompletion = self.removedOnCompletion;
copy.autoreverses = self.autoreverses;
copy.repeatCount = self.repeatCount;
copy.repeatForever = self.repeatForever;
}
return copy;
}
@end

View File

@ -8,18 +8,18 @@
*/
#import "POPAnimationExtras.h"
#import "POPAnimationPrivate.h"
#import "POPMath.h"
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#endif
#if TARGET_IPHONE_SIMULATOR
UIKIT_EXTERN CGFloat UIAnimationDragCoefficient(); // UIKit private drag coeffient, use judiciously
UIKIT_EXTERN float UIAnimationDragCoefficient(); // UIKit private drag coeffient, use judiciously
#endif
#import "POPMath.h"
CGFloat POPAnimationDragCoefficient()
{
#if TARGET_IPHONE_SIMULATOR

View File

@ -7,13 +7,14 @@
of patent rights can be found in the PATENTS file in the same directory.
*/
#import "POPAnimation.h"
#import <QuartzCore/CAMediaTimingFunction.h>
#import "POPAnimation.h"
#import "POPAction.h"
#import "POPAnimationRuntime.h"
#import "POPAnimationTracerInternal.h"
#import "POPSpringSolver.h"
#import "POPAction.h"
using namespace POP;
@ -34,7 +35,10 @@ typedef struct
bool reached;
} POPProgressMarker;
typedef void (^POPAnimationDidStartBlock)(POPAnimation *anim);
typedef void (^POPAnimationDidReachToValueBlock)(POPAnimation *anim);
typedef void (^POPAnimationCompletionBlock)(POPAnimation *anim, BOOL finished);
typedef void (^POPAnimationDidApplyBlock)(POPAnimation *anim);
@interface POPAnimation()
- (instancetype)_init;
@ -199,7 +203,10 @@ struct _POPAnimationState
CFTimeInterval startTime;
CFTimeInterval lastTime;
id __weak delegate;
POPAnimationDidStartBlock animationDidStartBlock;
POPAnimationDidReachToValueBlock animationDidReachToValueBlock;
POPAnimationCompletionBlock completionBlock;
POPAnimationDidApplyBlock animationDidApplyBlock;
NSMutableDictionary *dict;
POPAnimationTracer *tracer;
CGFloat progress;
@ -232,7 +239,10 @@ struct _POPAnimationState
startTime(0),
lastTime(0),
delegate(nil),
animationDidStartBlock(nil),
animationDidReachToValueBlock(nil),
completionBlock(nil),
animationDidApplyBlock(nil),
dict(nil),
tracer(nil),
progress(0),
@ -258,7 +268,10 @@ struct _POPAnimationState
name = nil;
dict = nil;
tracer = nil;
animationDidStartBlock = NULL;
animationDidReachToValueBlock = NULL;
completionBlock = NULL;
animationDidApplyBlock = NULL;
}
bool isCustom() {
@ -364,6 +377,12 @@ struct _POPAnimationState
ActionEnabler enabler;
[delegate pop_animationDidStart:self];
}
POPAnimationDidStartBlock block = animationDidStartBlock;
if (block != NULL) {
ActionEnabler enabler;
block(self);
}
if (tracing) {
[tracer didStart];
@ -451,6 +470,12 @@ struct _POPAnimationState
ActionEnabler enabler;
[delegate pop_animationDidApply:self];
}
POPAnimationDidApplyBlock block = animationDidApplyBlock;
if (block != NULL) {
ActionEnabler enabler;
block(self);
}
}
virtual void reset(bool all) {

View File

@ -26,6 +26,8 @@ enum POPValueType
kPOPValueTransform,
kPOPValueRange,
kPOPValueColor,
kPOPValueSCNVector3,
kPOPValueSCNVector4,
};
using namespace POP;
@ -43,12 +45,12 @@ extern POPValueType POPSelectValueType(id obj, const POPValueType *types, size_t
/**
Array of all value types.
*/
extern const POPValueType kPOPAnimatableAllTypes[10];
extern const POPValueType kPOPAnimatableAllTypes[12];
/**
Array of all value types supported for animation.
*/
extern const POPValueType kPOPAnimatableSupportTypes[8];
extern const POPValueType kPOPAnimatableSupportTypes[10];
/**
Returns a string description of a value type.

View File

@ -17,10 +17,10 @@
#import <UIKit/UIKit.h>
#endif
#import "POPVector.h"
#import "POPAnimationRuntime.h"
#import "POPCGUtils.h"
#import "POPDefines.h"
#import "POPGeometry.h"
#import "POPVector.h"
static Boolean pointerEqual(const void *ptr1, const void *ptr2) {
return ptr1 == ptr2;
@ -36,7 +36,7 @@ CFMutableDictionaryRef POPDictionaryCreateMutableWeakPointerToWeakPointer(NSUInt
// weak, pointer keys
kcb.retain = NULL;
kcb.retain = NULL;
kcb.release = NULL;
kcb.equal = pointerEqual;
kcb.hash = pointerHash;
@ -101,7 +101,7 @@ static bool FBCompareTypeEncoding(const char *objctype, POPValueType type)
#else
return false;
#endif
case kPOPValueAffineTransform:
return strcmp(objctype, @encode(CGAffineTransform)) == 0;
@ -122,6 +122,21 @@ static bool FBCompareTypeEncoding(const char *objctype, POPValueType type)
|| strcmp(objctype, @encode(long long)) == 0
|| strcmp(objctype, @encode(unsigned long long)) == 0
);
case kPOPValueSCNVector3:
#if SCENEKIT_SDK_AVAILABLE
return strcmp(objctype, @encode(SCNVector3)) == 0;
#else
return false;
#endif
case kPOPValueSCNVector4:
#if SCENEKIT_SDK_AVAILABLE
return strcmp(objctype, @encode(SCNVector4)) == 0;
#else
return false;
#endif
default:
return false;
}
@ -148,9 +163,9 @@ POPValueType POPSelectValueType(id obj, const POPValueType *types, size_t length
return kPOPValueUnknown;
}
const POPValueType kPOPAnimatableAllTypes[10] = {kPOPValueInteger, kPOPValueFloat, kPOPValuePoint, kPOPValueSize, kPOPValueRect, kPOPValueEdgeInsets, kPOPValueAffineTransform, kPOPValueTransform, kPOPValueRange, kPOPValueColor};
const POPValueType kPOPAnimatableAllTypes[12] = {kPOPValueInteger, kPOPValueFloat, kPOPValuePoint, kPOPValueSize, kPOPValueRect, kPOPValueEdgeInsets, kPOPValueAffineTransform, kPOPValueTransform, kPOPValueRange, kPOPValueColor, kPOPValueSCNVector3, kPOPValueSCNVector4};
const POPValueType kPOPAnimatableSupportTypes[8] = {kPOPValueInteger, kPOPValueFloat, kPOPValuePoint, kPOPValueSize, kPOPValueRect, kPOPValueEdgeInsets, kPOPValueColor};
const POPValueType kPOPAnimatableSupportTypes[10] = {kPOPValueInteger, kPOPValueFloat, kPOPValuePoint, kPOPValueSize, kPOPValueRect, kPOPValueEdgeInsets, kPOPValueColor, kPOPValueSCNVector3, kPOPValueSCNVector4};
NSString *POPValueTypeToString(POPValueType t)
{
@ -177,6 +192,10 @@ NSString *POPValueTypeToString(POPValueType t)
return @"CFRange";
case kPOPValueColor:
return @"CGColorRef";
case kPOPValueSCNVector3:
return @"SCNVector3";
case kPOPValueSCNVector4:
return @"SCNVector4";
default:
return nil;
}
@ -210,6 +229,16 @@ id POPBox(VectorConstRef vec, POPValueType type, bool force)
return (__bridge_transfer id)vec->cg_color();
break;
}
#if SCENEKIT_SDK_AVAILABLE
case kPOPValueSCNVector3: {
return [NSValue valueWithSCNVector3:vec->scn_vector3()];
break;
}
case kPOPValueSCNVector4: {
return [NSValue valueWithSCNVector4:vec->scn_vector4()];
break;
}
#endif
default:
return force ? [NSValue valueWithCGPoint:vec->cg_point()] : nil;
break;
@ -223,7 +252,11 @@ static VectorRef vectorize(id value, POPValueType type)
switch (type) {
case kPOPValueInteger:
case kPOPValueFloat:
#if CGFLOAT_IS_DOUBLE
vec = Vector::new_cg_float([value doubleValue]);
#else
vec = Vector::new_cg_float([value floatValue]);
#endif
break;
case kPOPValuePoint:
vec = Vector::new_cg_point([value CGPointValue]);
@ -245,6 +278,14 @@ static VectorRef vectorize(id value, POPValueType type)
case kPOPValueColor:
vec = Vector::new_cg_color(POPCGColorWithColor(value));
break;
#if SCENEKIT_SDK_AVAILABLE
case kPOPValueSCNVector3:
vec = Vector::new_scn_vector3([value SCNVector3Value]);
break;
case kPOPValueSCNVector4:
vec = Vector::new_scn_vector4([value SCNVector4Value]);
break;
#endif
default:
break;
}
@ -264,7 +305,7 @@ VectorRef POPUnbox(id value, POPValueType &animationType, NSUInteger &count, boo
// handle unknown types
if (kPOPValueUnknown == valueType) {
NSString *valueDesc = kPOPValueUnknown != valueType ? POPValueTypeToString(valueType) : [[value class] description];
NSString *valueDesc = [[value class] description];
[NSException raise:@"Unsuported value" format:@"Animating %@ values is not supported", valueDesc];
}

View File

@ -7,7 +7,7 @@
of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/NSObject.h>
#import <Foundation/Foundation.h>
@protocol POPAnimatorDelegate;

View File

@ -11,9 +11,14 @@
#import "POPAnimatorPrivate.h"
#import <list>
#import <objc/objc-auto.h>
#import <vector>
#if !TARGET_OS_IPHONE
#import <libkern/OSAtomic.h>
#endif
#import <objc/objc-auto.h>
#import <QuartzCore/QuartzCore.h>
#import "POPAnimation.h"
@ -82,6 +87,7 @@ static BOOL _disableBackgroundThread = YES;
CADisplayLink *_displayLink;
#else
CVDisplayLinkRef _displayLink;
int32_t _enqueuedRender;
#endif
POPAnimatorItemList _list;
CFMutableDictionaryRef _dict;
@ -106,9 +112,15 @@ static BOOL _disableBackgroundThread = YES;
static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *now, const CVTimeStamp *outputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *context)
{
if (_disableBackgroundThread) {
__unsafe_unretained POPAnimator *pa = (__bridge POPAnimator *)context;
int32_t* enqueuedRender = &pa->_enqueuedRender;
if (*enqueuedRender == 0) {
OSAtomicIncrement32(enqueuedRender);
dispatch_async(dispatch_get_main_queue(), ^{
[(__bridge POPAnimator*)context render];
OSAtomicDecrement32(enqueuedRender);
});
}
} else {
[(__bridge POPAnimator*)context render];
}
@ -429,8 +441,8 @@ static void stopAndCleanup(POPAnimator *self, POPAnimatorItemRef item, bool shou
// unlock
OSSpinLockUnlock(&_lock);
} else {
// copy list into vectory
std::vector<POPAnimatorItemRef> vector{ std::begin(items), std::end(items) };
// copy list into vector
std::vector<POPAnimatorItemRef> vector{ items.begin(), items.end() };
// unlock
OSSpinLockUnlock(&_lock);

View File

@ -88,3 +88,19 @@ DEFINE_RW_PROPERTY_OBJ(POPBasicAnimationState, timingFunction, setTimingFunction
}
@end
@implementation POPBasicAnimation (NSCopying)
- (instancetype)copyWithZone:(NSZone *)zone {
POPBasicAnimation *copy = [super copyWithZone:zone];
if (copy) {
copy.duration = self.duration;
copy.timingFunction = self.timingFunction; // not a 'copy', but timing functions are publicly immutable.
}
return copy;
}
@end

View File

@ -8,6 +8,7 @@
*/
#import "POPBasicAnimation.h"
#import "POPPropertyAnimationInternal.h"
// default animation duration

View File

@ -8,13 +8,17 @@
*/
#import <CoreGraphics/CoreGraphics.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#endif
#import "POPDefines.h"
#if TARGET_OS_IPHONE
@class UIColor;
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
#endif
#import "POPDefines.h"
#if SCENEKIT_SDK_AVAILABLE
#import <SceneKit/SceneKit.h>
#endif
POP_EXTERN_C_BEGIN
@ -34,6 +38,18 @@ NS_INLINE CGRect values_to_rect(const CGFloat values[])
return CGRectMake(values[0], values[1], values[2], values[3]);
}
#if SCENEKIT_SDK_AVAILABLE
NS_INLINE SCNVector3 values_to_vec3(const CGFloat values[])
{
return SCNVector3Make(values[0], values[1], values[2]);
}
NS_INLINE SCNVector4 values_to_vec4(const CGFloat values[])
{
return SCNVector4Make(values[0], values[1], values[2], values[3]);
}
#endif
#if TARGET_OS_IPHONE
NS_INLINE UIEdgeInsets values_to_edge_insets(const CGFloat values[])
@ -63,6 +79,23 @@ NS_INLINE void values_from_rect(CGFloat values[], CGRect r)
values[3] = r.size.height;
}
#if SCENEKIT_SDK_AVAILABLE
NS_INLINE void values_from_vec3(CGFloat values[], SCNVector3 v)
{
values[0] = v.x;
values[1] = v.y;
values[2] = v.z;
}
NS_INLINE void values_from_vec4(CGFloat values[], SCNVector4 v)
{
values[0] = v.x;
values[1] = v.y;
values[2] = v.z;
values[3] = v.w;
}
#endif
#if TARGET_OS_IPHONE
NS_INLINE void values_from_edge_insets(CGFloat values[], UIEdgeInsets i)
@ -88,7 +121,7 @@ extern CGColorRef POPCGColorRGBACreate(const CGFloat components[]) CF_RETURNS_RE
/**
Takes a color reference and returns a CGColor.
*/
extern CGColorRef POPCGColorWithColor(id color);
extern CGColorRef POPCGColorWithColor(id color) CF_RETURNS_NOT_RETAINED;
#if TARGET_OS_IPHONE
@ -102,6 +135,18 @@ extern void POPUIColorGetRGBAComponents(UIColor *color, CGFloat components[]);
*/
extern UIColor *POPUIColorRGBACreate(const CGFloat components[]) NS_RETURNS_RETAINED;
#else
/**
Takes a NSColor and converts it into RGBA components, if necessary.
*/
extern void POPNSColorGetRGBAComponents(NSColor *color, CGFloat components[]);
/**
Takes RGBA components and returns a NSColor.
*/
extern NSColor *POPNSColorRGBACreate(const CGFloat components[]) NS_RETURNS_RETAINED;
#endif
POP_EXTERN_C_END

View File

@ -9,42 +9,34 @@
#import "POPCGUtils.h"
#if TARGET_OS_IPHONE
#import <UIKit/UIColor.h>
#else
#import <AppKit/NSColor.h>
#endif
#import <objc/runtime.h>
void POPCGColorGetRGBAComponents(CGColorRef color, CGFloat components[])
{
if (!color) {
#if TARGET_OS_IPHONE
color = [UIColor clearColor].CGColor;
#else
color = [NSColor clearColor].CGColor;
#endif
}
const CGFloat *colors = CGColorGetComponents(color);
size_t count = CGColorGetNumberOfComponents(color);
if (4 == count) {
// RGB colorspace
components[0] = colors[0];
components[1] = colors[1];
components[2] = colors[2];
components[3] = colors[3];
} else if (2 == count) {
// Grey colorspace
components[0] = components[1] = components[2] = colors[0];
components[3] = colors[1];
if (color) {
const CGFloat *colors = CGColorGetComponents(color);
size_t count = CGColorGetNumberOfComponents(color);
if (4 == count) {
// RGB colorspace
components[0] = colors[0];
components[1] = colors[1];
components[2] = colors[2];
components[3] = colors[3];
} else if (2 == count) {
// Grey colorspace
components[0] = components[1] = components[2] = colors[0];
components[3] = colors[1];
} else {
// Use CI to convert
CIColor *ciColor = [CIColor colorWithCGColor:color];
components[0] = ciColor.red;
components[1] = ciColor.green;
components[2] = ciColor.blue;
components[3] = ciColor.alpha;
}
} else {
// Use CI to convert
CIColor *ciColor = [CIColor colorWithCGColor:color];
components[0] = ciColor.red;
components[1] = ciColor.green;
components[2] = ciColor.blue;
components[3] = ciColor.alpha;
memset(components, 0, 4 * sizeof(components[0]));
}
}
@ -71,7 +63,44 @@ CGColorRef POPCGColorWithColor(id color)
}
#else
else if ([color isKindOfClass:[NSColor class]]) {
return [color CGColor];
// -[NSColor CGColor] is only supported since OSX 10.8+
if ([color respondsToSelector:@selector(CGColor)]) {
return [color CGColor];
}
/*
* Otherwise create a CGColorRef manually.
*
* The original accessor is (or would be) declared as:
* @property(readonly) CGColorRef CGColor;
* - (CGColorRef)CGColor NS_RETURNS_INNER_POINTER CF_RETURNS_NOT_RETAINED;
*
* (Please note that OSX' accessor is atomic, while iOS' isn't.)
*
* The access to the NSColor object must thus be synchronized
* and the CGColorRef be stored as an associated object,
* to return a reference which doesn't need to be released manually.
*/
@synchronized(color) {
static const void* key = &key;
CGColorRef colorRef = (__bridge CGColorRef)objc_getAssociatedObject(color, key);
if (!colorRef) {
size_t numberOfComponents = [color numberOfComponents];
CGFloat components[numberOfComponents];
CGColorSpaceRef colorSpace = [[color colorSpace] CGColorSpace];
[color getComponents:components];
colorRef = CGColorCreate(colorSpace, components);
objc_setAssociatedObject(color, key, (__bridge id)colorRef, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
CGColorRelease(colorRef);
}
return colorRef;
}
}
#endif
return nil;
@ -81,7 +110,7 @@ CGColorRef POPCGColorWithColor(id color)
void POPUIColorGetRGBAComponents(UIColor *color, CGFloat components[])
{
return POPCGColorGetRGBAComponents(color.CGColor, components);
return POPCGColorGetRGBAComponents(POPCGColorWithColor(color), components);
}
UIColor *POPUIColorRGBACreate(const CGFloat components[])
@ -92,5 +121,30 @@ UIColor *POPUIColorRGBACreate(const CGFloat components[])
return color;
}
#else
void POPNSColorGetRGBAComponents(NSColor *color, CGFloat components[])
{
return POPCGColorGetRGBAComponents(POPCGColorWithColor(color), components);
}
NSColor *POPNSColorRGBACreate(const CGFloat components[])
{
CGColorRef colorRef = POPCGColorRGBACreate(components);
NSColor *color = nil;
if (colorRef) {
if ([NSColor respondsToSelector:@selector(colorWithCGColor:)]) {
color = [NSColor colorWithCGColor:colorRef];
} else {
color = [NSColor colorWithCIColor:[CIColor colorWithCGColor:colorRef]];
}
CGColorRelease(colorRef);
}
return color;
}
#endif

View File

@ -7,9 +7,10 @@
of patent rights can be found in the PATENTS file in the same directory.
*/
#import "POPCustomAnimation.h"
#import "POPAnimationInternal.h"
#import "POPCustomAnimation.h"
@interface POPCustomAnimation ()
@property (nonatomic, copy) POPCustomAnimationBlock animate;
@end
@ -54,3 +55,21 @@
}
@end
/**
* Note that only the animate block is copied, but not the current/elapsed times
*/
@implementation POPCustomAnimation (NSCopying)
- (instancetype)copyWithZone:(NSZone *)zone {
POPCustomAnimation *copy = [super copyWithZone:zone];
if (copy) {
copy.animate = self.animate;
}
return copy;
}
@end

View File

@ -80,7 +80,11 @@ DEFINE_RW_PROPERTY(POPDecayAnimationState, deceleration, setDeceleration:, CGFlo
POPValueType velocityType = POPSelectValueType(self.originalVelocity, supportedVelocityTypes, POP_ARRAY_COUNT(supportedVelocityTypes));
if (velocityType == kPOPValueFloat) {
#if CGFLOAT_IS_DOUBLE
CGFloat originalVelocityFloat = [(NSNumber *)self.originalVelocity doubleValue];
#else
CGFloat originalVelocityFloat = [(NSNumber *)self.originalVelocity floatValue];
#endif
NSNumber *negativeOriginalVelocityNumber = @(-originalVelocityFloat);
reversedVelocity = negativeOriginalVelocityNumber;
} else if (velocityType == kPOPValueInteger) {
@ -179,3 +183,21 @@ DEFINE_RW_PROPERTY(POPDecayAnimationState, deceleration, setDeceleration:, CGFlo
}
@end
@implementation POPDecayAnimation (NSCopying)
- (instancetype)copyWithZone:(NSZone *)zone {
POPDecayAnimation *copy = [super copyWithZone:zone];
if (copy) {
// Set the velocity to the animation's original velocity, not its current.
copy.velocity = self.originalVelocity;
copy.deceleration = self.deceleration;
}
return copy;
}
@end

View File

@ -8,6 +8,9 @@
*/
#import "POPDecayAnimation.h"
#import <cmath>
#import "POPPropertyAnimationInternal.h"
// minimal velocity factor before decay animation is considered complete, in units / s
@ -58,7 +61,7 @@ struct _POPDecayAnimationState : _POPPropertyAnimationState
CGFloat f = dynamicsThreshold * kPOPAnimationDecayMinimalVelocityFactor;
const CGFloat *velocityValues = vec_data(velocityVec);
for (NSUInteger idx = 0; idx < valueCount; idx++) {
if (fabsf(velocityValues[idx]) >= f)
if (std::abs((velocityValues[idx])) >= f)
return false;
}
return true;
@ -79,7 +82,7 @@ struct _POPDecayAnimationState : _POPPropertyAnimationState
duration = MAX(MAX(MAX(log(fabs(vx)) / d, log(fabs(vy)) / d), log(fabs(vz)) / d), log(fabs(vw)) / d);
// ensure velocity threshold is exceeded
if (isnan(duration) || duration < 0) {
if (std::isnan(duration) || duration < 0) {
duration = 0;
}
}
@ -105,40 +108,6 @@ struct _POPDecayAnimationState : _POPPropertyAnimationState
toVec = toValue;
}
void computeDestinationValues() {
// to value assuming final velocity as a factor of dynamics threshold
// derived from v' = v * d^dt used in decay_position
// to compute the to value with maximal dt, p' = p + (v * d) / (1 - d)
VectorRef fromValue = NULL != currentVec ? currentVec : fromVec;
if (!fromValue) {
return;
}
VectorRef toValue(Vector::new_vector(fromValue.get()));
// compute duration till threshold velocity
Vector4r scaledVelocity = vector4(velocityVec) / 1000.;
double k = dynamicsThreshold * kPOPAnimationDecayMinimalVelocityFactor / 1000.;
double vx = k / scaledVelocity.x;
double vy = k / scaledVelocity.y;
double vz = k / scaledVelocity.z;
double vw = k / scaledVelocity.w;
double d = log(deceleration) * 1000.;
duration = MAX(MAX(MAX(log(fabs(vx)) / d, log(fabs(vy)) / d), log(fabs(vz)) / d), log(fabs(vw)) / d);
// ensure velocity threshold is exceeded
if (isnan(duration) || duration < 0) {
duration = 0;
} else {
// compute to value
Vector4r velocity = velocityVec->vector4r();
decay_position(toValue->data(), velocity.data(), valueCount, duration, deceleration);
}
toVec = toValue;
}
bool advance(CFTimeInterval time, CFTimeInterval dt, id obj) {
// advance past not yet initialized animations
if (NULL == currentVec) {

View File

@ -10,6 +10,8 @@
#ifndef POP_POPDefines_h
#define POP_POPDefines_h
#import <Availability.h>
#ifdef __cplusplus
# define POP_EXTERN_C_BEGIN extern "C" {
# define POP_EXTERN_C_END }
@ -26,4 +28,10 @@
# define POP_NOTHROW
#endif
#if TARGET_OS_MAC
#define SCENEKIT_SDK_AVAILABLE defined(POP_USE_SCENEKIT)
#elif TARGET_OS_IPHONE
#define SCENEKIT_SDK_AVAILABLE defined(POP_USE_SCENEKIT)
#endif
#endif

View File

@ -65,3 +65,30 @@
@end
#endif
#if TARGET_OS_IPHONE
#import "POPDefines.h"
#if SCENEKIT_SDK_AVAILABLE
#import <SceneKit/SceneKit.h>
/**
Dirty hacks because iOS is weird and decided to define both SCNVector3's and SCNVector4's objCType as "t". However @encode(SCNVector3) and @encode(SCNVector4) both return the proper definition ("{SCNVector3=fff}" and "{SCNVector4=ffff}" respectively)
[[NSValue valueWithSCNVector3:SCNVector3Make(0.0, 0.0, 0.0)] objcType] returns "t", whereas it should return "{SCNVector3=fff}".
*flips table*
*/
@implementation NSValue (SceneKitFixes)
+ (NSValue *)valueWithSCNVector3:(SCNVector3)vec3 {
return [NSValue valueWithBytes:&vec3 objCType:@encode(SCNVector3)];
}
+ (NSValue *)valueWithSCNVector4:(SCNVector4)vec4 {
return [NSValue valueWithBytes:&vec4 objCType:@encode(SCNVector4)];
}
@end
#endif
#endif

View File

@ -8,6 +8,7 @@
*/
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import "POPDefines.h"

View File

@ -8,8 +8,9 @@
*/
#import "POPMath.h"
#import "UnitBezier.h"
#import "POPAnimationPrivate.h"
#import "UnitBezier.h"
void POPInterpolateVector(NSUInteger count, CGFloat *dst, const CGFloat *from, const CGFloat *to, CGFloat f)
{

View File

@ -103,3 +103,23 @@ DEFINE_RW_PROPERTY_OBJ_COPY(POPPropertyAnimationState, progressMarkers, setProgr
}
@end
@implementation POPPropertyAnimation (NSCopying)
- (instancetype)copyWithZone:(NSZone *)zone {
POPPropertyAnimation *copy = [super copyWithZone:zone];
if (copy) {
copy.property = [self.property copyWithZone:zone];
copy.fromValue = self.fromValue;
copy.toValue = self.toValue;
copy.roundingFactor = self.roundingFactor;
copy.clampMode = self.clampMode;
copy.additive = self.additive;
}
return copy;
}
@end

View File

@ -231,6 +231,12 @@ struct _POPPropertyAnimationState : _POPAnimationState
[delegate pop_animationDidReachToValue:self];
}
POPAnimationDidReachToValueBlock block = animationDidReachToValueBlock;
if (block != NULL) {
ActionEnabler enabler;
block(self);
}
if (tracing) {
[tracer didReachToValue:POPBox(currentValue(), valueType, true)];
}

View File

@ -36,13 +36,13 @@
/**
@abstract The effective bounciness.
@discussion Use in conjunction with 'springSpeed' to change animation effect. Values are converted into corresponding dynamics constants. Defined as a value in the range [0, 20]. Defaults to 4.
@discussion Use in conjunction with 'springSpeed' to change animation effect. Values are converted into corresponding dynamics constants. Higher values increase spring movement range resulting in more oscillations and springiness. Defined as a value in the range [0, 20]. Defaults to 4.
*/
@property (assign, nonatomic) CGFloat springBounciness;
/**
@abstract The effective speed.
@discussion Use in conjunction with 'springBounciness' to change animation effect. Values are converted into corresponding dynamics constants. Defined as a value in the range [0, 20]. Defaults to 12.
@discussion Use in conjunction with 'springBounciness' to change animation effect. Values are converted into corresponding dynamics constants. Higher values increase the dampening power of the spring resulting in a faster initial velocity and more rapid bounce slowdown. Defined as a value in the range [0, 20]. Defaults to 12.
*/
@property (assign, nonatomic) CGFloat springSpeed;

View File

@ -63,8 +63,10 @@
{
POPPropertyAnimationState *s = __state;
VectorRef vec = POPUnbox(aValue, s->valueType, s->valueCount, YES);
VectorRef origVec = POPUnbox(aValue, s->valueType, s->valueCount, YES);
if (!vec_equal(vec, s->velocityVec)) {
s->velocityVec = vec;
s->originalVelocityVec = origVec;
if (s->tracing) {
[s->tracer updateVelocity:aValue];
@ -162,3 +164,29 @@ FB_PROPERTY_GET(POPSpringAnimationState, springBounciness, CGFloat);
}
@end
@implementation POPSpringAnimation (NSCopying)
- (instancetype)copyWithZone:(NSZone *)zone {
POPSpringAnimation *copy = [super copyWithZone:zone];
if (copy) {
id velocity = POPBox(__state->originalVelocityVec, __state->valueType);
// If velocity never gets set, then POPBox will return nil, messing up __state->valueCount.
if (velocity) {
copy.velocity = velocity;
}
copy.springBounciness = self.springBounciness;
copy.springSpeed = self.springSpeed;
copy.dynamicsTension = self.dynamicsTension;
copy.dynamicsFriction = self.dynamicsFriction;
copy.dynamicsMass = self.dynamicsMass;
}
return copy;
}
@end

View File

@ -7,6 +7,8 @@
of patent rights can be found in the PATENTS file in the same directory.
*/
#import <cmath>
#import "POPAnimationExtras.h"
#import "POPPropertyAnimationInternal.h"
@ -46,7 +48,7 @@ struct _POPSpringAnimationState : _POPPropertyAnimationState
const CGFloat *previous2Values = previous2Vec->data();
for (NSUInteger idx = 0; idx < count; idx++) {
if ((fabsf(toValues[idx] - previousValues[idx]) >= t) || (fabsf(previous2Values[idx] - previousValues[idx]) >= t)) {
if ((std::abs(toValues[idx] - previousValues[idx]) >= t) || (std::abs(previous2Values[idx] - previousValues[idx]) >= t)) {
return false;
}
}

View File

@ -13,11 +13,20 @@
#include <iostream>
#include <vector>
#import <CoreGraphics/CoreGraphics.h>
#import <objc/NSObjCRuntime.h>
#import <CoreGraphics/CoreGraphics.h>
#import "POPDefines.h"
#if SCENEKIT_SDK_AVAILABLE
#import <SceneKit/SceneKit.h>
#endif
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#endif
#import "POPMath.h"
namespace POP {
@ -336,6 +345,16 @@ namespace POP {
// CGColorRef support
CGColorRef cg_color() const CF_RETURNS_RETAINED;
static Vector *new_cg_color(CGColorRef color);
#if SCENEKIT_SDK_AVAILABLE
// SCNVector3 support
SCNVector3 scn_vector3() const;
static Vector *new_scn_vector3(const SCNVector3 &vec3);
// SCNVector4 support
SCNVector4 scn_vector4() const;
static Vector *new_scn_vector4(const SCNVector4 &vec4);
#endif
// operator overloads
CGFloat &operator[](size_t i) const {

View File

@ -8,6 +8,8 @@
*/
#import "POPVector.h"
#import "POPDefines.h"
#import "POPCGUtils.h"
namespace POP
@ -177,7 +179,7 @@ namespace POP
{
return _count < 4 ? CGRectZero : CGRectMake(_values[0], _values[1], _values[2], _values[3]);
}
Vector *Vector::new_cg_rect(const CGRect &r)
{
Vector *v = new Vector(4);
@ -250,6 +252,37 @@ namespace POP
POPCGColorGetRGBAComponents(color, rgba);
return new_vector(4, rgba);
}
#if SCENEKIT_SDK_AVAILABLE
SCNVector3 Vector::scn_vector3() const
{
return _count < 3 ? SCNVector3Make(0.0, 0.0, 0.0) : SCNVector3Make(_values[0], _values[1], _values[2]);
}
Vector *Vector::new_scn_vector3(const SCNVector3 &vec3)
{
Vector *v = new Vector(3);
v->_values[0] = vec3.x;
v->_values[1] = vec3.y;
v->_values[2] = vec3.z;
return v;
}
SCNVector4 Vector::scn_vector4() const
{
return _count < 4 ? SCNVector4Make(0.0, 0.0, 0.0, 0.0) : SCNVector4Make(_values[0], _values[1], _values[2], _values[3]);
}
Vector *Vector::new_scn_vector4(const SCNVector4 &vec4)
{
Vector *v = new Vector(4);
v->_values[0] = vec4.x;
v->_values[1] = vec4.y;
v->_values[2] = vec4.z;
v->_values[3] = vec4.w;
return v;
}
#endif
void Vector::subRound(CGFloat sub)
{

View File

@ -25,9 +25,11 @@
*/
#include "TransformationMatrix.h"
#include "FloatConversion.h"
#include <math.h>
#include "FloatConversion.h"
inline double deg2rad(double d) { return d * M_PI / 180.0; }
inline double rad2deg(double r) { return r * 180.0 / M_PI; }
inline double deg2grad(double d) { return d * 400.0 / 360.0; }

View File

@ -27,7 +27,9 @@
#define TransformationMatrix_h
#include <string.h> //for memcpy
#include <CoreGraphics/CGAffineTransform.h>
#include <QuartzCore/QuartzCore.h>
namespace WebCore {

View File

@ -7,8 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
0C82E12AA6B21B9923F1513B /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF8391D3904F99D24AFC56B7 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
179C33542C5CE15556FFE8AB /* Pods_TabBarPicker_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FEB67354A0F6C45C1B502A65 /* Pods_TabBarPicker_Example.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
0C82E12AA6B21B9923F1513B /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF8391D3904F99D24AFC56B7 /* Pods.framework */; };
179C33542C5CE15556FFE8AB /* Pods_TabBarPicker_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FEB67354A0F6C45C1B502A65 /* Pods_TabBarPicker_Example.framework */; };
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
@ -24,7 +24,7 @@
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
68934F521B579CC0000022DE /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 68934F511B579CC0000022DE /* Media.xcassets */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
C80475EA65AD1B9A0B206ACD /* Pods_TabBarPicker_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AADF60077A50EEA12BCBBD1 /* Pods_TabBarPicker_Tests.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
C80475EA65AD1B9A0B206ACD /* Pods_TabBarPicker_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AADF60077A50EEA12BCBBD1 /* Pods_TabBarPicker_Tests.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -251,7 +251,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = TabBarPicker;
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = "Giuseppe Nucifora";
TargetAttributes = {
6003F5AD195388D20070C39A = {
@ -460,6 +460,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@ -525,6 +526,7 @@
INFOPLIST_FILE = "TabBarPicker/TabBarPicker-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@ -541,6 +543,7 @@
INFOPLIST_FILE = "TabBarPicker/TabBarPicker-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@ -563,6 +566,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TabBarPicker_Example.app/TabBarPicker_Example";
WRAPPER_EXTENSION = xctest;
@ -582,6 +586,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
INFOPLIST_FILE = "Tests/Tests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TabBarPicker_Example.app/TabBarPicker_Example";
WRAPPER_EXTENSION = xctest;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0600"
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
@ -48,15 +48,18 @@
ReferencedContainer = "container:TabBarPicker.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
@ -72,10 +75,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">

View File

@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -7,8 +7,8 @@
//
#import "TabBarPickerViewController.h"
#import "TabBarPicker.h"
#import <PureLayout/PureLayout.h>
#import <TabBarPicker/TabBarPicker.h>
@interface TabBarPickerViewController () {
TabBarPicker *tabbar;
@ -23,60 +23,106 @@
self = [super init];
if (self) {
TabBarSubItem *subItem1 = [TabBarSubItem tabBarSubItemWithName:@"Peppe" andValue:@"Peppe"];
TabBarSubItem *subItem2 = [TabBarSubItem tabBarSubItemWithName:@"Peppe1" andValue:@"Peppe1"];
TabBarSubItem *subItem3 = [TabBarSubItem tabBarSubItemWithName:@"Peppe2" andValue:@"Peppe2"];
TabBarSubItem *subItem4 = [TabBarSubItem tabBarSubItemWithName:@"Peppe3" andValue:@"Peppe3"];
TabBarSubItem *subItem5 = [TabBarSubItem tabBarSubItemWithName:@"Peppe4" andValue:@"Peppe4"];
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"Peppe5" andValue:@"Peppe5"];
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"Peppe6" andValue:@"Peppe6"];
TabBarPickerSubItemsView *locationSubview = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:YES];
TabBarSubItem *subItem1 = [TabBarSubItem tabBarSubItemWithName:@"1 Km" value:[NSNumber numberWithInt:1] andReference:[NSNumber numberWithInt:1]];
TabBarSubItem *subItem2 = [TabBarSubItem tabBarSubItemWithName:@"5 Km" value:[NSNumber numberWithInt:5] andReference:[NSNumber numberWithInt:5]];
TabBarSubItem *subItem3 = [TabBarSubItem tabBarSubItemWithName:@"10 Km" value:[NSNumber numberWithInt:10] andReference:[NSNumber numberWithInt:10]];
TabBarSubItem *subItem4 = [TabBarSubItem tabBarSubItemWithName:@"20 Km" value:[NSNumber numberWithInt:20] andReference:[NSNumber numberWithInt:20]];
TabBarSubItem *subItem5 = [TabBarSubItem tabBarSubItemWithName:@"30 Km" value:[NSNumber numberWithInt:30] andReference:[NSNumber numberWithInt:30]];
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"50 Km" value:[NSNumber numberWithInt:50] andReference:[NSNumber numberWithInt:50]];
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"100 Km" value:[NSNumber numberWithInt:100] andReference:[NSNumber numberWithInt:100]];
TabBarSubItem *subItem8 = [TabBarSubItem tabBarSubItemWithName:@"150 Km" value:[NSNumber numberWithInt:150] andReference:[NSNumber numberWithInt:150]];
TabBarSubItem *subItem9 = [TabBarSubItem tabBarSubItemWithName:@"200 Km" value:[NSNumber numberWithInt:200] andReference:[NSNumber numberWithInt:200]];
TabBarPickerSubItemsView *locationSubview = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeDistance subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7,subItem8,subItem9] needsLocalization:YES];
TabBarItem *location = [[TabBarItem alloc] initWithSubItemView:locationSubview];
[location setItemName:@"Location"];
[location setItemName:NSLocalizedString(@"Distanza", @"")];
[location setItemSearchKey:@"location"];
[location setImage:[UIImage imageNamed:@"location"]];
[location setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[location setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
TabBarPickerSubItemsView *locationSubview1 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
TabBarPickerSubItemsView *calendarSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeDateAndTime subItems:nil];
TabBarItem *location1 = [[TabBarItem alloc] initWithSubItemView:locationSubview1];
[location1 setItemName:@"Location2"];
[location1 setImage:[UIImage imageNamed:@"location"]];
[location1 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[location1 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
TabBarItem *calendar = [[TabBarItem alloc] initWithSubItemView:calendarSubView];
[calendar setItemName:NSLocalizedString(@"Data e ora", @"")];
[calendar setItemSearchKey:@"reservationEndTime"];
[calendar setImage:[UIImage imageNamed:@"location"]];
[calendar setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[calendar setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
TabBarPickerSubItemsView *locationSubview2 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
TabBarItem *location2 = [[TabBarItem alloc] initWithSubItemView:locationSubview2];
[location2 setItemName:@"Location3"];
[location2 setImage:[UIImage imageNamed:@"location"]];
[location2 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[location2 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
NSMutableArray *typesArray = [[NSMutableArray alloc] init];
TabBarPickerSubItemsView *locationSubview3 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
TabBarItem *location3 = [[TabBarItem alloc] initWithSubItemView:locationSubview3];
[location3 setItemName:@"Location4"];
[location3 setImage:[UIImage imageNamed:@"location"]];
[location3 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[location3 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
for (NSInteger i=0; i<100; i++) {
TabBarSubItem *item = [TabBarSubItem tabBarSubItemWithName:[NSString stringWithFormat:@"Type %ld",i] value:[NSString stringWithFormat:@"Type %ld",i] andReference:@"Type %ld" forType:TabBarSubItemsViewTypeCheckBox];
[typesArray addObject:item];
}
TabBarPickerSubItemsView *locationSubview4 = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButtons subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7] needsLocalization:NO];
TabBarItem *location4 = [[TabBarItem alloc] initWithSubItemView:locationSubview4];
[location4 setItemName:@"Location5"];
[location4 setImage:[UIImage imageNamed:@"location"]];
[location4 setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[location4 setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
TabBarPickerSubItemsView *typeSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeCheckBox subItems:typesArray];
tabbar = [[TabBarPicker alloc] initWithTabBarItems:@[location,location1,location2,location3,location4] forPosition:TabBarPickerPositionBottom];
TabBarItem *type = [[TabBarItem alloc] initWithSubItemView:typeSubView];
[type setItemName:NSLocalizedString(@"Custom Type", @"")];
[type setItemSearchKey:@"custom"];
[type setImage:[UIImage imageNamed:@"location"]];
[type setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[type setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
NSMutableArray *subItemsArray = [[NSMutableArray alloc] init];
for (int i =0; i< 30; i++) {
TabBarSubItem *item;
if (i < 30-1) {
item = [TabBarSubItem tabBarSubItemWithName:@"€" firstValue:[NSNumber numberWithInteger:i] secondValue:[NSNumber numberWithInteger:i+1] andReference:nil];
}
else {
item = [TabBarSubItem tabBarSubItemWithName:@"€" firstValue:[NSNumber numberWithInteger:i] secondValue:@"MAX" andReference:nil];
[item setIsLast:YES];
}
[subItemsArray addObject:item];
}
TabBarPickerSubItemsView *priceSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypePrice subItems:subItemsArray];
TabBarItem *price =[[TabBarItem alloc] initWithSubItemView:priceSubView];
[price setItemName:NSLocalizedString(@"Prezzo", @"")];
[price setItemSearchKey:@"price"];
[price setImage:[UIImage imageNamed:@"location"]];
[price setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[price setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
NSMutableArray *customsArray = [[NSMutableArray alloc] init];
for (NSInteger i=0; i<100; i++) {
TabBarSubItem *item = [TabBarSubItem tabBarSubItemWithName:[NSString stringWithFormat:@"Custom %ld",i] value:[NSString stringWithFormat:@"Custom %ld",i] andReference:@"Custom %ld"];
[customsArray addObject:item];
}
TabBarPickerSubItemsView *customSubView = [[TabBarPickerSubItemsView alloc] initWithType:TabBarPickerSubItemsViewTypeButton subItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7,subItem8,subItem9]];
TabBarItem *custom = [[TabBarItem alloc] initWithSubItemView:customSubView];
[custom setItemName:NSLocalizedString(@"Custom", @"")];
[custom setItemSearchKey:@"customs"];
[custom setImage:[UIImage imageNamed:@"location"]];
[custom setSelectedImage:[UIImage imageNamed:@"location_selected"]];
[custom setHighlightedImage:[UIImage imageNamed:@"location_highlighted"]];
tabbar = [[TabBarPicker alloc] initWithTabBarItems:@[location,calendar,type,price,custom] forPosition:TabBarPickerPositionBottom];
[tabbar setItemSpacing:0];
[tabbar setBackgroundColor:[UIColor whiteColor]];
//[tabbar addItem:allergen2];
//[tabbar addItem:custom2];
}
return self;
}
@ -99,61 +145,11 @@
[super viewDidLoad];
//[self.view setBackgroundColor:[UIColor lightGrayColor]];
// Do any additional setup after loading the view, typically from a nib.
// Do any additional setup after loading the view, typically from a nib.
}
- (void) viewDidAppear:(BOOL)animated {
//[tabbar selectItem:0];
/*TabBarSubItem *subItem1 = [TabBarSubItem tabBarSubItemWithName:@"Peppe"];
TabBarSubItem *subItem2 = [TabBarSubItem tabBarSubItemWithName:@"Peppe1"];
TabBarSubItem *subItem3 = [TabBarSubItem tabBarSubItemWithName:@"Peppe2"];
TabBarSubItem *subItem4 = [TabBarSubItem tabBarSubItemWithName:@"Peppe3"];
TabBarSubItem *subItem5 = [TabBarSubItem tabBarSubItemWithName:@"Peppe4"];
TabBarSubItem *subItem6 = [TabBarSubItem tabBarSubItemWithName:@"Peppe5"];
TabBarSubItem *subItem7 = [TabBarSubItem tabBarSubItemWithName:@"Peppe6"];
TabBarItem *allergen = [[TabBarItem alloc] initWithSubItems:@[subItem1,subItem2,subItem3,subItem4,subItem5,subItem6,subItem7]];
[allergen setItemName:@"Allergen"];
[allergen setImage:[UIImage imageNamed:@"allergen"]];
[allergen setSelectedImage:[UIImage imageNamed:@"allergen_selected"]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar addItem:allergen];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar show];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(6 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar hide];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(9 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar show];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar hide];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar show];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(18 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar hide];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(21 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar show];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(24 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[tabbar hide];
});*/
[super viewDidAppear:animated];
}
- (void)didReceiveMemoryWarning

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>

View File

@ -47,6 +47,11 @@
*/
@property (nonatomic, strong) NSString *itemName;
/**
* Represents the name of the item that can be shown in picker.
*/
@property (nonatomic, strong) NSString *itemSearchKey;
/**
* Represents the sub items that appeare when you select the item in picker.
*/
@ -74,4 +79,6 @@
- (void) setHighlighted:(BOOL) highlighted;
- (void) setSelected:(BOOL)selected;
@end

View File

@ -12,7 +12,7 @@
#import "UIButton+BackgroundColor.h"
#import <UIKit/UIKit.h>
@interface TabBarItem()
@interface TabBarItem() <TabBarPickerSubItemsViewDelegate>
@property (nonatomic, strong) UIButton *itemButton;
@ -39,20 +39,20 @@
_orientation = [[UIDevice currentDevice] orientation];
_itemSubView = itemSubView;
_itemButton = [[UIButton alloc] initForAutoLayout];
_highlightedColor = [@"ff4e50" colorFromHex];
_itemButton = [UIButton newAutoLayoutView];
[_itemButton addTarget:self action:@selector(itemButtonTapped) forControlEvents:UIControlEventTouchUpInside];
[_itemButton setBackgroundColor:[@"ff4e50" colorFromHex] forState:UIControlStateHighlighted];
[_itemButton setBackgroundColor:_highlightedColor forState:UIControlStateHighlighted];
[_itemButton setBackgroundColor:_highlightedColor forState:UIControlStateSelected|UIControlStateHighlighted];
[self addSubview:_itemButton];
}
return self;
}
- (void) layoutSubviews {
//[_itemButton autoPinEdgesToSuperviewMargins];
if (!_didSetupConstraints) {
[_itemButton autoCenterInSuperview];
[_itemButton autoSetDimension:ALDimensionHeight toSize:44];
@ -62,6 +62,14 @@
}
}
- (void) setTag:(NSInteger)tag {
[super setTag:tag];
for (UIView *subView in self.subviews) {
[subView setTag:tag];
}
[_itemSubView setTag:tag];
}
- (void)deviceOrientationDidChange:(NSNotification *)notification {
//Obtain current device orientation
_orientation = [[UIDevice currentDevice] orientation];
@ -76,29 +84,40 @@
- (void) setSelectedImage:(UIImage *)selectedImage {
[_itemButton setImage:selectedImage forState:UIControlStateSelected];
[_itemButton setImage:selectedImage forState:UIControlStateSelected|UIControlStateHighlighted];
//[_itemButton setImage:selectedImage forState:UIControlStateSelected|UIControlStateHighlighted];
}
- (void) setHighlightedImage:(UIImage *)highlightedImage {
[_itemButton setImage:highlightedImage forState:UIControlStateHighlighted];
[_itemButton setImage:highlightedImage forState:UIControlStateHighlighted|UIControlStateNormal];
[_itemButton setImage:highlightedImage forState:UIControlStateSelected|UIControlStateHighlighted];
}
- (void) setHighlightedColor:(UIColor *)highlightedColor {
_highlightedColor = highlightedColor;
[_itemButton setBackgroundColor:_highlightedColor forState:UIControlStateHighlighted];
}
- (void) setHighlighted:(BOOL) highlighted {
[_itemButton setHighlighted:highlighted];
}
- (void) setSelected:(BOOL)selected {
[_itemButton setSelected:selected];
}
- (void) setItemName:(NSString *)itemName {
[_itemSubView setItemName:itemName];
_itemName = itemName;
}
- (void) itemButtonTapped {
if (_delegate && [_delegate respondsToSelector:@selector(tabBarItemSelected:)]) {
[_delegate tabBarItemSelected:self];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.00001 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.000001 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self setHighlighted:YES];
});
}

View File

@ -11,6 +11,15 @@
#import "TabBarSubItem.h"
#import "TabBarPickerSubItemsView.h"
@class TabBarPicker;
@protocol TabBarPickerDelegate <NSObject>
- (void) TabBarPicker:(TabBarPicker*) picker filtersDidChanges:(NSDictionary *) filtersEnabled;
@end
typedef NS_ENUM(NSInteger, TabBarPickerPosition) {
// Informational
TabBarPickerPositionLeft,
@ -31,6 +40,9 @@ typedef NS_ENUM(NSInteger, TabBarPickerPosition) {
@property (nonatomic, readonly) CGFloat subItemHeight;
@property (nonatomic) BOOL dimWhenShow;
@property (nonatomic, strong) UIColor * dimColor;
@property (nonatomic, assign) id<TabBarPickerDelegate> delegate;
@property (nonatomic, strong,readonly) NSMutableDictionary *filtersEnabled;
/**
* Init TabBarPicker with items. When is selected an item the picher show down subitems.

View File

@ -10,10 +10,12 @@
#import <PureLayout/PureLayout.h>
#import "TabBarPickerSubItemsView.h"
#import "MMCPSScrollView.h"
#import <UIView-Overlay/UIView+Overlay.h>
#import "NSString+HexColor.h"
#import <QuartzCore/QuartzCore.h>
@interface TabBarPicker() <TabBarPickerSubItemsViewDelegate,TabBarItemDelegate>
#define SUPERVIEW_TAG -9999
@interface TabBarPicker() <TabBarPickerSubItemsViewDelegate,TabBarItemDelegate,MMCPSScrollViewDelegate>
@property (nonatomic) UIDeviceOrientation orientation;
@property (nonatomic, strong) NSMutableArray *subItemSelectors;
@ -25,9 +27,15 @@
@property (nonatomic, strong) NSMutableArray *tabBarItemsConstraints;
@property (nonatomic, strong) TabBarItem *selectedTabBarItem;
@property (nonatomic, strong) UIView *separator;
@property (nonatomic, strong) UIView *tabBarView;
@property (nonatomic, strong) MMCPSScrollView *subItemScrollView;
@property (nonatomic, strong) UIView* dimView;
@end
@implementation TabBarPicker
@ -49,6 +57,8 @@
self = [self initForAutoLayout];
if (self) {
[self setUserInteractionEnabled:YES];
_filtersEnabled = [[NSMutableDictionary alloc] init];
_itemSpacing = 10;
_layoutRelation = relation;
_position = position;
@ -58,6 +68,10 @@
_subItemSelectorsConstraints = [[NSMutableArray alloc] init];
_dimColor = [[@"333333" colorFromHex] colorWithAlphaComponent: 0.5];
_dimView = [UIView newAutoLayoutView];
[_dimView setAlpha:0];
[_dimView setBackgroundColor:_dimColor];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver: self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object: nil];
@ -70,14 +84,19 @@
_tabBarItems = [[NSMutableArray alloc] init];
_tabBarView = [[UIView alloc] initForAutoLayout];
_tabBarView = [UIView newAutoLayoutView];
_separator = [UIView newAutoLayoutView];
[_separator.layer setMasksToBounds:NO];
[_separator setBackgroundColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.3]];
[self addSubview:_tabBarView];
for (NSObject *item in items) {
if (item && [item isKindOfClass:[TabBarItem class]]) {
TabBarItem *_item = (TabBarItem*)item;
[_item setTag:SUPERVIEW_TAG];;
[_tabBarItems addObject:_item];
[(TabBarItem*)_item setDelegate:self];
@ -85,7 +104,7 @@
}
}
_subItemScrollView = [[MMCPSScrollView alloc] initForAutoLayout];
_subItemScrollView = [MMCPSScrollView newAutoLayoutView];
[_subItemScrollView setPagingEnabled:YES];
[_subItemScrollView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
[_subItemScrollView setUserInteractionEnabled:YES];
@ -93,6 +112,12 @@
[_subItemScrollView setPageSize:1];
[self addSubview:_subItemScrollView];
[self addSubview:_tabBarView];
[self addSubview:_separator];
[self setTag:SUPERVIEW_TAG];
}
[self updateConstraintsIfNeeded];
@ -103,6 +128,14 @@
- (void) layoutSubviews {
if (!_didSetupConstraints) {
if (self.superview) {
[self.superview insertSubview:_dimView belowSubview:self];
[_dimView autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:self.superview];
[_dimView autoMatchDimension:ALDimensionHeight toDimension:ALDimensionHeight ofView:self.superview];
[_dimView autoAlignAxis:ALAxisHorizontal toSameAxisOfView:self.superview];
[_dimView autoAlignAxis:ALAxisVertical toSameAxisOfView:self.superview];
}
switch (_position) {
case TabBarPickerPositionLeft:{
@ -160,6 +193,10 @@
[_tabBarView autoAlignAxisToSuperviewAxis:ALAxisVertical];
[_tabBarView autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:self];
[_separator autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:self.superview];
[_separator autoSetDimension:ALDimensionHeight toSize:1];
[_separator autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:_tabBarView];
[_tabBarItems autoSetViewsDimension:ALDimensionHeight toSize:44.0];
[[_tabBarItems firstObject] autoAlignAxisToSuperviewAxis:ALAxisHorizontal];
@ -174,36 +211,13 @@
[_subItemScrollView setType:MMCPSScrollHorizontal];
if ([_tabBarItems count] > 0) {
int i = 0;
for (TabBarItem *item in _tabBarItems) {
if ([item itemSubView]) {
[item setTag:SUPERVIEW_TAG];
[[item itemSubView] setDelegate:self];
[[item itemSubView] setTabBarItemReference:self];
switch (i) {
case 0:
[[item itemSubView] setBackgroundColor:[UIColor lightGrayColor]];
break;
case 1:{
[[item itemSubView] setBackgroundColor:[UIColor redColor]];
}
break;
case 2:{
[[item itemSubView] setBackgroundColor:[UIColor greenColor]];
}
break;
case 3: {
[[item itemSubView] setBackgroundColor:[UIColor yellowColor]];
}
break;
default:{
[[item itemSubView] setBackgroundColor:[UIColor blueColor]];
}
break;
}
i++;
[[item itemSubView] setTabBarItemReference:item];
[_subItemScrollView addSubview:[item itemSubView]];
[_subItemSelectors addObject:[item itemSubView]];
@ -221,11 +235,21 @@
}
_didSetupConstraints = YES;
[self updateConstraintsIfNeeded];
}
}
- (void) setTag:(NSInteger)tag {
[super setTag:tag];
for (UIView *subView in self.subviews) {
[subView setTag:tag];
}
for (UIView *subView in _subItemScrollView.subviews) {
[subView setTag:tag];
}
}
- (void) setPosition:(TabBarPickerPosition)position {
_position = position;
@ -239,6 +263,7 @@
_orientation = [[UIDevice currentDevice] orientation];
}
- (void) addItem:(TabBarItem*) item {
if (item && [item isKindOfClass:[TabBarItem class]]) {
@ -275,9 +300,10 @@
options:0
animations:^{
if (_dimWhenShow) {
[self.superview ag_addOverlayWithColor:_dimColor];
self.layer.zPosition = 999;
//[self.superview insertSubview:_dimView belowSubview:self];
[_dimView setAlpha:1];
//[self.superview ag_addOverlayWithColor:_dimColor];
//self.layer.zPosition = 999;
}
switch (_position) {
case TabBarPickerPositionLeft: {
@ -325,8 +351,10 @@
options:0
animations:^{
if (_dimWhenShow) {
[self.superview ag_removeOverlay];
self.layer.zPosition = 0;
//[self.superview ag_removeOverlay];
//self.layer.zPosition = 0;
[_dimView setAlpha:0];
}
switch (_position) {
case TabBarPickerPositionLeft: {
@ -350,21 +378,82 @@
break;
}
}
[_selectedTabBarItem setHighlighted:NO];
_selectedTabBarItem = nil;
[self layoutIfNeeded];
}
completion:^(BOOL finished) {
// Run the animation again in the other direction
//[_dimView removeFromSuperview];
}];
}
}
#pragma mark TabBarPickerSubItemsViewDelegate
- (void) tabarPickerSubItemsView:(TabBarPickerSubItemsView*) tabarPickerSubItemsView didSelect:(TabBarItem*) item {
- (void) tabBarPickerSubItemsView:(TabBarPickerSubItemsView*) tabBarPickerSubItemsView didSelectTabBarSubItem:(TabBarSubItem*) subItem forTabBarItem:(TabBarItem*) item {
switch (tabBarPickerSubItemsView.type) {
case TabBarPickerSubItemsViewTypeDistance: {
[_filtersEnabled setObject:subItem forKey:[item itemSearchKey]];
break;
}
case TabBarPickerSubItemsViewTypeDateAndTime: {
[_filtersEnabled setObject:subItem forKey:[item itemSearchKey]];
break;
}
case TabBarPickerSubItemsViewTypePrice: {
[_filtersEnabled setObject:subItem forKey:[item itemSearchKey]];
break;
}
case TabBarPickerSubItemsViewTypeCheckBox: {
[_filtersEnabled setObject:subItem forKey:[item itemSearchKey]];
break;
}
case TabBarPickerSubItemsViewTypeButton: {
[_filtersEnabled setObject:subItem forKey:[item itemSearchKey]];
break;
}
default: {
break;
}
}
if (_delegate && [_delegate respondsToSelector:@selector(TabBarPicker:filtersDidChanges:)]) {
[_delegate TabBarPicker:self filtersDidChanges:_filtersEnabled];
}
}
- (void) tabBarPickerSubItemsView:(TabBarPickerSubItemsView*) tabBarPickerSubItemsView didSelectTabBarSubItems:(NSArray*) subItems forTabBarItem:(TabBarItem*) item {
[_filtersEnabled setObject:subItems forKey:[item itemSearchKey]];
if (_delegate && [_delegate respondsToSelector:@selector(TabBarPicker:filtersDidChanges:)]) {
[_delegate TabBarPicker:self filtersDidChanges:_filtersEnabled];
}
}
- (void) tabBarPickerSubItemsView:(TabBarPickerSubItemsView*) tabBarPickerSubItemsView didResetTabBarSubItem:(TabBarSubItem *)subItem forTabBarItem:(TabBarItem *)item {
[_filtersEnabled removeObjectForKey:[item itemSearchKey]];
if (_delegate && [_delegate respondsToSelector:@selector(TabBarPicker:filtersDidChanges:)]) {
[_delegate TabBarPicker:self filtersDidChanges:_filtersEnabled];
}
}
- (void) tabBarPickerSubItemsView:(TabBarPickerSubItemsView*) tabBarPickerSubItemsView didResetTabBarSubItems:(NSArray*) subItems forTabBarItem:(TabBarItem*) item {
[_filtersEnabled removeObjectForKey:[item itemSearchKey]];
if (_delegate && [_delegate respondsToSelector:@selector(TabBarPicker:filtersDidChanges:)]) {
[_delegate TabBarPicker:self filtersDidChanges:_filtersEnabled];
}
}
#pragma mark -
#pragma mark TabBarPickerSubItemsViewDataSource
#pragma mark -
#pragma mark TabBarItemDelegate
@ -394,13 +483,54 @@
#pragma mark MMCPSScrollViewDelegate
- (void)scrollView:(MMCPSScrollView *)scrollView didScrollToPage:(NSUInteger)pageIndex {
NSLog(@"The MMCPSScrollView is now on page %i.", pageIndex);
if ([scrollView currentPage] > 0 && [_tabBarItems count] > [scrollView currentPage]-1) {
TabBarItem *selectedItem = [_tabBarItems objectAtIndex:[scrollView currentPage]-1];
for (TabBarItem *item in _tabBarItems) {
if (![item isEqual:selectedItem]) {
[item setHighlighted:NO];
}
else {
[item setHighlighted:YES];
}
}
if (!_isShow) {
[self show];
}
else {
if(![_selectedTabBarItem isEqual:selectedItem]) {
}
}
_selectedTabBarItem = selectedItem;
}
}
- (void)scrollView:(MMCPSScrollView *)scrollView willScrollToPage:(NSUInteger)pageIndex {
NSLog(@"The MMCPSScrollView is now going to page %i.", pageIndex);
}
#pragma mark -
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if (!self.isUserInteractionEnabled || self.isHidden || self.alpha <= 0.01) {
return nil;
}
if ([self pointInside:point withEvent:event]) {
for (UIView *subview in [self.subviews reverseObjectEnumerator]) {
CGPoint convertedPoint = [subview convertPoint:point fromView:self];
UIView *hitTestView = [subview hitTest:convertedPoint withEvent:event];
if (hitTestView) {
return hitTestView;
}
}
return self;
}
[self hide];
return nil;
}
@end

Some files were not shown because too many files have changed in this diff Show More