rsully / rscolorpicker Goto Github PK
View Code? Open in Web Editor NEWiOS color picker view with brightness control, opacity control, and delegation support.
License: Other
iOS color picker view with brightness control, opacity control, and delegation support.
License: Other
Right now to make a release a few things need to happen:
Without setCropToCircle:
being set, various methods like validPointForTouch:
get confused because _activeAreaShape
is nil. This method should not be necessary (i.e. there should be a default value).
Because of how the selection circle is rendered, the color selected ends up layering itself and making the spot you have selected darker than the surrounding picker. This does not affect the color returned via delegates/etc, but is a visual issue.
I'm getting the following error message while using the CGContextFillRects,CGContextAddPath and CGContextSetFillColorWithColor in ios 7.0 and in ios 7.1 it getting crashed.
CGContextFillRects: invalid context 0x0.
See conversation at dblapps@22a9bfd#commitcomment-5642713
After initializing an RSColorPickerView
, I would expect to be able to immediately call setSelectionColor:
. However, calling this has no effect until after the picker view has received a didMoveToWindow
call.
width is set to equal to height, not able to use use for different size (200 width and 300 height)
After digging into NSOperations again it looks like I implemented it incorrectly here. Based on what I've read, there is no need for -isConcurrent
, -isExecuting
, and -isFinished
to be implemented as our operation should be non-concurrent, whereas the queue is what handles concurrency.
The implementation for setSelectionColor seems hit-or-miss. For instance:
self.colorPicker.selectionColor = [UIColor blueColor]; //works
self.colorPicker.selectionColor = [UIColor yellowColor]; //works
self.colorPicker.selectionColor = [UIColor blackColor]; //selects green
self.colorPicker.selectionColor = [UIColor redColor]; //crashes the app
Apple broke their own rules when writing UIKit - you have assumed they will call the method:
initWithFrame:
...which they are required to. However, Apple never ever calls this method when NIB files exist.
Also, your implementation requires the frame to exist - but Apple does not provide a valid frame when loading from NIB.
So:
If you do this, it works fine. If you don't, it will never work in a project that uses NIBs.
Hi, When i pass a image in rscolorpicker I am not getting any change in UI and response
Hi,
I've been using RSColorPicker in my app for a while.
I just updated to XCode51-DP2 and the 7.1 beta and I am getting the errors below when I access RSColorPicker in my app.
Just to be sure I ran the standalone RSColorPicker example project and I also got the same errors.
RSColorPicker[20655] : CGContextAddPath: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
RSColorPicker[20655] : clip: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
These errors seem to prevent the app from continuing.
jb
RSColorPicker.m has a bug on line 263. The cropToCircle test is flipped. It currently reads:
-(CGPoint)validPointForTouch:(CGPoint)touchPoint {
if (!cropToCircle) {
//Constrain point to inside of bounds
...
And it should instead be:
-(CGPoint)validPointForTouch:(CGPoint)touchPoint {
if (cropToCircle) {
//Constrain point to inside of bounds
...
Thanks for the great project!
After installing RSColorPicker with cocoapods , a fatal error is generated due the compiler being unable to find the ANImageBitmapRep.h file. Investigating further I verified that ANImageBitmapRep.h is present in the BuildHeaders directory as shown below:
30> pwd
/Users/bromo/my_app/Pods/BuildHeaders/RSColorPicker
31> ls -l ANImageBitmapRep.h
lrwxr-xr-x 1 bromo 501 88B Feb 26 00:34 ANImageBitmapRep.h@ -> ../../RSColorPicker/RSColorPicker/ColorPickerClasses/ANImageBitmapRep/ANImageBitmapRep.h
32> ls -l ../../RSColorPicker/RSColorPicker/ColorPickerClasses/ANImageBitmapRep/ANImageBitmapRep.h
-rw-r--r-- 1 bromo 501 2.9K Feb 26 00:34 ../../RSColorPicker/RSColorPicker/ColorPickerClasses/ANImageBitmapRep/ANImageBitmapRep.h
Lindas-iMacCoreDuo 33>
I looked at the the include file search paths and noticed that -isystem and -iquotes options to clang are incorrect causing ANImageBitmapRep.h not to be found. Here are the incorrect options from the command line.
-isystem/Users/bromo/myapp/Pods/Headers
-isystem/Users/bromo/myapp/Pods/Headers/RSColorPicker
-iquotePods/Headers
-iquotePods/Headers/RSColorPicke
The isystem and iquote options are keyword options so they required a space between the keyword and the path argument. I am under the impression that absolute paths are required so the relative path specified for the quote options are incorrect as well.
Here is log entry for the failing compile:
CompileC /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Objects-normal/i386/TTTallyViewController.o Tennis\ Tally/TTTallyViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/bromo/SWDevelopment/iOS/ICare/Tennis Tally"
setenv LANG en_US.US-ASCII
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wno-bool-conversion -Wenum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DCOCOAPODS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=7.0 -iquote /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Tennis\ Tally-generated-files.hmap -I/Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Tennis\ Tally-own-target-headers.hmap -I/Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Tennis\ Tally-all-target-headers.hmap -iquote /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Tennis\ Tally-project-headers.hmap -iquotePods/Headers -iquotePods/Headers/RSColorPicker -I/Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Products/Debug-iphonesimulator/include -I/Users/bromo/SWDevelopment/iOS/ICare/Tennis\ Tally/Pods/Headers -I/Users/bromo/SWDevelopment/iOS/ICare/Tennis\ Tally/Pods/Headers/RSColorPicker -I/Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/DerivedSources/i386 -I/Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/DerivedSources -fdiagnostics-show-option -Wall -Wextra -Wcast-align -Wconversion -Wfloat-equal -Wformat=2 -Wimplicit-atomic-properties -Wmissing-declarations -Wmissing-prototypes -Woverlength-strings -Wshadow -Wstrict-selector-match -Wundeclared-selector -Wunreachable-code -Wno-unused-parameter -F/Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Products/Debug-iphonesimulator -isystem/Users/bromo/SWDevelopment/iOS/ICare/Tennis\ Tally/Pods/Headers -isystem/Users/bromo/SWDevelopment/iOS/ICare/Tennis\ Tally/Pods/Headers/RSColorPicker -include /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/PrecompiledHeaders/Tennis\ Tally-Prefix-ckhjlxjsrlidtvdtzlbsqnznyzfj/Tennis\ Tally-Prefix.pch -MMD -MT dependencies -MF /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Objects-normal/i386/TTTallyViewController.d --serialize-diagnostics /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Objects-normal/i386/TTTallyViewController.dia -c /Users/bromo/SWDevelopment/iOS/ICare/Tennis\ Tally/Tennis\ Tally/TTTallyViewController.m -o /Users/bromo/Library/Developer/Xcode/DerivedData/Tennis_Tally-eddfuwlvfcrrhdfnoloifwpzxowc/Build/Intermediates/Tennis\ Tally.build/Debug-iphonesimulator/Tennis\ Tally.build/Objects-normal/i386/TTTallyViewController.o
In file included from /Users/bromo/SWDevelopment/iOS/ICare/Tennis Tally/Tennis Tally/TTTallyViewController.m:9:
In file included from /Users/bromo/SWDevelopment/iOS/ICare/Tennis Tally/Tennis Tally/TTTallyViewController.h:10:
/Users/bromo/SWDevelopment/iOS/ICare/Tennis Tally/Pods/Headers/RSColorPicker/RSColorPickerView.h:11:9: fatal error: 'ANImageBitmapRep.h' file not found
#import "ANImageBitmapRep.h"
^
1 error generated.
It would be great if the podspec could be updated to 0.8.1 so I can get this release using CocoaPods.
The 0.8.3 pod spec file s.source statement is referencing the code tagged 0.8.2.
If anyone has any thoughts I'd be open to a discussion. I skimmed through the differences on tldr;legal: my takeaway is they are pretty similar.
The read me could be expanded a bit in some of the following ways:
A push nor modal transition activates the animation, however animation is performed on exiting view controller.
I want to pass color to RSColorPicker and want to select the corresponding color... it works for the colors
for present BRIGHTNESS slider value or colors which are presently showing in color picker view, lets say user passes BLACK color to it, selects GREEN ... How could i set brightness corresponding to color passed or calculate the brightness for passed color and set it, Any ideas or fixes then please suggest ... ?
I've created a Cocoapods pod spec for this project that can be found here:
Ideally getting some semantic tags would be better than pointing to an actual commit.
If you are willing to add some tags, I will submit the podspec to the Cocoapods repository for others that wants to use if.
Thanks a lot for all your effort, it's a great component.
Right now there is a animation glitch with the loupe when a user does a quick tap on the color picker.
When I import this framework into my project using CocoaPods, in file RSColorPickerView.h Xcode seems that can't find the file ANImageBitmapRep.h
The error is:
(project directory)/Pods/Headers/RSColorPicker/RSColorPickerView.h:12:9: 'ANImageBitmapRep.h' file not found
I use Xcode 5.0.1 on Mavericks, testing on iOS 7.0.3 (64-bit)
The current podspec is invalid so cannot be included in the repo...
daniels-imac:RSColorPicker-0.8.1 Daniel$ cd "/Users/Daniel/Downloads/RSColorPicker-master"
daniels-imac:RSColorPicker-master Daniel$ pod spec lint
-> RSColorPicker (0.8.1)
- ERROR | [iOS] [xcodebuild] RSColorPicker/RSColorPicker/ColorPickerClasses/BGRSLoupeLayer.m:33:9: fatal error: 'RSOpacitySlider.h' file not found
Analyzed 1 podspec.
[!] The spec did not pass validation.
There should be a way to update the brightness slider when the selection color changes
This seems like a bug to me. Basically, it is impossible to set the color of the picker to any value that lies in the corners of the square (cropToCircle = NO).
Example, pick a color with the picker. For example, this one http://cl.ly/RQ7g
This is 1.000000 0.000000 0.752941 1.000000 (RGB A). Now do a
[_colorPicker setSelectionColor:[UIColor colorWithRed:1 green:0 blue:0.752941 alpha:1]];
The result will be http://cl.ly/RQ15 which is a different color that lies exactly on the boundaries of the circle. This is not correct. If I set cropToCircle to NO, colors picked and set within the boundaries of the square not the circle should work.
When sliding on iPad it takes several seconds to refresh. Same goes for getting the view to show initially. Most likely due to making a sqrt call for every pixel...
These commits have some good ideas:
Once the iOS 7 SDK is publicly released it would be a good idea to go through the test project and see what needs updating.
It also might be a good idea to look at the API changes and see if there are any new things we could take advantage of.
I downloaded the source code for my project and works perfectly, but when I change to use cocoapods, I found that 'RSBrightnessSlider' is MISSING!
One more problem, there is a build error, and its NOT the same with the source code, so I think you might forgot to update the pod?
Error private header:
#import "ANImageBitmapRep.h"
See unixpickle/ANImageBitmapRep#9
(This was reported to me and I have made this issue on behalf of a user.)
What to do to workaround currently:
-DTARGET_OS_IPHONE
to "Other C Flags"#import
statementCan i change the color of the RSColorPickerView?
I don't want the color of the color, I want to custom colors
The title says it all. I have a stored UIColor value and would like to provide it to RSColorPickerView for display. Is there currently a way to do it?
Thanks
IMO, validPointForTouch: in RSColorPickerView.m should be fixed like this :
-(CGPoint)validPointForTouch:(CGPoint)touchPoint {
- if (!cropToCircle) return touchPoint;
+ if (!cropToCircle)
+ {
+ if(touchPoint.x < 0) touchPoint.x = 0;
+ if(touchPoint.y < 0) touchPoint.y = 0;
+ if(touchPoint.x > self.frame.size.width) touchPoint.x = self.frame.size.width-0.1;
+ if(touchPoint.y > self.frame.size.height) touchPoint.y = self.frame.size.height-0.1;
+ return touchPoint;
+ }
Is it possible to use a custom image instead of the color picker view to pick colors?
See issue #8 starting at this comment: #8 (comment)
-genBitmap
is slow and causes the color picker to block the main thread during each initialization.
Prior discussion:
I'm sorry for jumping into the discussion like this but I'm very interested in hearing if anyone have figured out a way to improve the performance when loading the color picker? It gives me a very bad performance on my iPhone 5 so when pushing a view which contains the control onto my navigation stack, it does so without any animation. However, it seems that when the control has been loaded, the performance is really great.
I'm guessing the load slowdown is due to the loops and calculations in genBitmap. There's no need to generate a gradient background every single time (since the color wheel will likely never resize), so I'm to experiment with a static background from a screenshot.
@unixpickle was kind enough to work with me on the current set of guidelines, but it is lacking a few things.
The screenshots in the README are out of date
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.