Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 74

NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
11/09/14 10:03 PM (9 years ago)

Color Picker - code for iOS

Found some code this weekend, and figured let me give it a try integrating into my BT iOS project. I had been thinking of how to give the user an easy way to pick a color… I started with adding a Blank Screen plugin and added my modifications to the .h and .m. (It is not a PlugIn, but code and assets can drop right into a project. (after you add a BT_Blank Plugin) Here is a pic in my app: https://www.dropbox.com/s/7gbp55cxjwhjakl/ColorPicker.jpg?dl=0 A few notes on what it does now: • The circle shown can be dragged or tapped to select a new hue and saturation. • The Brightness bar is also dynamic by tap or slide • The buttons on the bottom are setup to support images. • Color saved via SetPref in viewWillDisappear after OK button. • Color loaded via GetPref in viewWillAppear. • Background color and Image set via standard Control Panel Currently setup for 320x568 portrait only iPhone, but layout could easily be moved up by removing the top label and changing height locations. Here is where I need help: There is an existing setColor method in one of the view controllers, which is used after the user changes either location (hue, sat or brightness). However I cannot get the method public so it can be called from the other. – a lack of knowledge at this point. o Setting the current color from the saved color on screen load, as well as when user taps White or Black buttons. o One line of code needed to hook actual color value in save routine. (Hardcoded to a UIColor for test right now.) ========================================================== It probably will take less than an hour for many of the BT gurus here, with most of that time spent in setup and test. PM me if you know that it would be an easy fix for you, and you are interested. I will send the code and docs. Then hopefully it will also be something you could transmogrify for use in one of your apps. Not now, but if there is interest on BT- I would like to try making into a Plugin later so I could learn the process, as well as make it easier for others to implement with minimal coding. Thanks!
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
11/11/14 06:55 AM (9 years ago)
Good work! :-)
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
11/11/14 07:23 PM (9 years ago)
Thanks Niraj. Sent you a PM
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.