HKHelperKit fixes some annoyances when developing Objective-C applications. Mostly it just adds some methods to SDK classes to make them easier and less verbose to use.
- Clone this repository into a subfolder within your project.
- Drag the
HKHelperKitinside this repository to your XCode project, NOT including theTestSuitefiolder. - Now simply use
#include "HKHelperKit.h"anywhere that you want to useHKHelperKitmethods. (I like the.pchfile so it's everytwhere)
This list is WAY out of date... Just checkout the header files to see what's up.
HKHelperKit enhances the following classes in the following ways:
[NSString stringFromResource:@"MyFile.html"];loads an app resource from teh main bundle with teh provided file name into an autoreleased string.- Simple search methods
[@"foobar" conatinsString:@"oob"];[@"foobar" startsWithString:@"foo"];[@"foobar" endsWithString:@"bar"];
[someString isPresent];method that is shorthand for:string != nil && ![string isEqualToString:@""];.[@"foobar" compareCaseInsensitive:@"FooBAR"];NSDataconversion[NSString stingWithData:someNSDataObject];[NSString stingWithData:someNSDataObject encoding:NSASCIIStringEncoding];[@"foobar" data]
[@"foo/space here" stringByEscapingURL]=>@"foo%2Fspace%20here"[@"foo/space here" stringByPercentEscapingCharacters:@" "]=>@"foo/space%20here"
[UIAlertView showSimpleAlertWithTitle:@"A Title" message:@"A Message!"];Shows an alert with anOKbutton[UIAlertView showSimpleAlertWithTitle:@"A Title" message:@"A Message!" buttonTitle:@"Not OK"];Shows an alert with a single custom button title
- Convenience Initializers
[UIBarButtonItem itemWithSystemType:UIBarButtonSystemItemAdd];[UIBarButtonItem itemWithSystemType:UIBarButtonSystemItemAdd target:object action:@selector(someSelector)];[UIBarButtonItem itemWithTitle:@"foobar" target:object action:@selector(someSelector)];[UIBarButtonItem itemWithImage:someUIImage target:object action:@selector(someSelector)];[UIBarButtonItem flexibleSpace];[UIBarButtonItem fixedSpace:123];
- Added
NSCodingsupport toUIImage [someImage imageByResizing:CGSizeMake(123, 456)];
navigationController.backViewControllerread only property that works just liketopViewControllerexcept it return the controller immediately preceding the top one (or nil).
- Convenience Initializers
[UIViewController controller];[UIViewController controllerWithNib];This loads the nib with the same name as the view controller class.[MyController controllerWithNib]is the same as[[[MyController alloc] initWithNibName:@"MyController" bundle:nil] autorelease][UIViewController controllerWithNibName:@"SomeNibName"];[UIViewController controllerWithNibName:@"SomeNibName" bundle:someBundle];[[UIViewController alloc] initWithNibName:@"SomeNibName"];[[UIViewController alloc] initWithNib];instance level initializer that works as described in thecontrollerWithNibclass method.