![]() |
EnkiUtils
Small library of classes that Enki Labs uses internally.
|
#import <EnkiUtilities.h>


Class Methods | |
| (UIColor *) | + defaultBackgroundColor: |
| (float) | + pixelsForRetina: |
| (BOOL) | + AlmostEqualRelative:and: |
| (void) | + keyboardWasShown:view:scrollView:activeField:activeCell: |
EnkiUtilities is a fairly vague collection of methods, classes, and class categories that I've developed over the years that I find personally useful when writing iOS apps. Feel free to use any or all of these in your apps.
The categories, in particular, contain code that I've mostly not written, but rather found on line, mostly likely on stackoverflow and I've linked to the the authors when I can. I specifically do not claim copyright no them, they are not my work, just work that has been released into the wild for public consumption. (To be strictly legal, I should contact these authors for permission since they have not specified what licenese they've used, but that really seems like over kill for something that is short and published by the others for the purpose of reuse!
Copyright (c) 2010-2013 Enki Labs, and other specified authors
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.
Definition at line 89 of file EnkiUtilities.h.
| + (BOOL) AlmostEqualRelative: | (float) | A | |
| and: | (float) | B | |
Returns TRUE if the two float numbers are almost equal. Be sure to read http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ This is a good algorightm for Enkid's applications, for many applications this is not at all good. Read and understand
Definition at line 24 of file EnkiUtilities.m.
| + (UIColor *) defaultBackgroundColor: | (UITableViewCell *) | inCell |
Returns the background color of tabbed group cell. This color changed between iOS4 and iOS5
Note how we use the static UIColor object as a cache so we only have do some expensive operations once.
Definition at line 45 of file EnkiUtilities.m.
| + (void) keyboardWasShown: | (NSNotification *) | aNotification | |
| view: | (UIViewController *) | view | |
| scrollView: | (UITableView *) | scrollView | |
| activeField: | (UIView *) | activeField | |
| activeCell: | (UITableViewCell *) | activeCell | |
keyboardWasShown should be called from your keyboard Notification code to scroll the keyboard into view
| the | notification object sent with the notification that the keyboard was raised |
| view | the view that the keyboard is being raised from |
| the | srollview that contains the table that the active field (and optionally, the active cell) |
| the | field that is being typed into |
| the | cell in the table that the field is in. May be nil |
| + (float) pixelsForRetina: | (float) | pixels |
returns the number of pixels needed, multiplying by 2 for Retina displays.
Definition at line 13 of file EnkiUtilities.m.