Docs
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
<!DOCTYPE html> <html lang="en"> <head> <title>KNMultiItemSelector - Documentation</title> <link rel="stylesheet" media="screen" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" > <link rel="stylesheet" media="screen" href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css" > <script src='http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js'></script> <style> a img { border: 1px solid gray; box-shadow: 0 0 4px rgba(0,0,0,0.3); } a img:hover { border: 1px solid blue; } h2 { font-size: 1.5em; } h1 { background-color: #F6F6F6; padding: 5px; margin: 0; } #buymecoffee { position:fixed; top:0; right:5%; background-color: #F6F6F6; border-radius: 0 0 6px 6px; padding: 5px 10px; border: 1px solid #CCC; box-shadow: 0px 1px 10px rgba(0,0,0,0.2); } </style> </head> <body onload="prettyPrint()"> <div class="container-fluid"> <div class="page-header"> <h1>KNMultiItemSelector <small>Facebook Friends Selector demo project</small></h1> </div> KNMultiItemSelector is a versatile drop in multiple items selector for iOS projects. It works with both iPhone and iPad for several usage scenarios. See features and screenshots below.<BR><BR> <strong>Features:</strong> <ul> <li>Multiple items selector with simple NSArray <li>Subclass of UIViewController <li>Enable/Disable table index <li>Enable/Disable search control <li>Enable/Disable recent items <li>Optional image with out-of-box caching <li>Facebook friends selector demo project </ul> <h2>Basic Demo & Facebook Friends Selector Demo</h2> <iframe width="320" height="480" src="http://www.youtube.com/embed/6t2YK6fKohY?HD=1;rel=0;showinfo=0;controls=0;autoplay=1" frameborder="0" allowfullscreen></iframe> <h2>iPhone and iPad screenshots</h2> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss2.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss2.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss3.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss3.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss4.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss4.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss1.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss1.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss5.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ss5.png' height='200px' /></a> <br><br> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss1.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss1.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss2.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss2.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss3.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss3.png' height='200px' /></a> <a href='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss4.png' target='_blank' title='click to zoom'><img src='https://github.com/kentnguyen/KNMultiItemSelector/raw/master/Docs/screenshots/ipad_ss4.png' height='200px' /></a> <div class="page-header"> <h1>Getting started <small>All configurations you need</small></h1> </div> <h2>Requirements</h2> <ul> <li>Xcode 4.2 and above <li>You are using ARC for this project <li>Minimum deployment target is iOS 4.2 </ul> <h2>Installation</h2> <ol> <li>Drag and drop the entire <code>KNMultiItemSelector</code> into your project <li><code>#import "KNMultiItemSelector.h"</code> in your implementation <li>Add these required Frameworks in your project: <code>ImageIO</code>, <code>CoreGraphics</code> <li>If your project already has <code>SDWebImage</code> you could remove the one bundled with this control <li>See examples below or run <strong>KNFBFriendSelectorDemo</strong> </ol> <div class="page-header"> <h1>Usage examples</h1> </div> <h2>Creating array of items</h2> Simply create a NSArray which contains multiple KNSelectorItem. You can have a separate selected value such as user's ID as part of the item. <pre class="prettyprint"> NSMutableArray * items = [NSMutableArray array]; [items addObject:[[KNSelectorItem alloc] initWithDisplayValue:@"Apple Seed"]]; [items addObject:[[KNSelectorItem alloc] initWithDisplayValue:@"Apple Seed" selectValue:@"appl" imageUrl:nil]]; </pre> <h2>Optional sorting</h2> There are two built-in sort methods to allow sorting by displayValue or selectValue. You must do this before creating the selector <pre class="prettyprint"> NSArray * sortedItems = [items sortedArrayUsingSelector:@selector(compareByDisplayValue:)]; NSArray * sortedItems = [items sortedArrayUsingSelector:@selector(compareBySelectValue:)]; </pre> <h2>Creating and presenting the selector</h2> Create the selector instance using one of the init methods, you have the option to change the title string and the search control placeholder string here <pre class="prettyprint"> KNMultiItemSelector * selector = [[KNMultiItemSelector alloc] initWithItems:items delegate:self]; // or KNMultiItemSelector * selector = [[KNMultiItemSelector alloc] initWithItems:items preselectedItems:nil title:@"Select a flavor" placeholderText:@"Search for something" delegate:self]; </pre> Then you can present the selector just like another UIViewController, take note of the UINavigationController. <pre class="prettyprint"> UINavigationController * uinav = [[UINavigationController alloc] initWithRootViewController:selector]; uinav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; // iPhone uinav.modalPresentationStyle = UIModalPresentationFormSheet; // iPad only [self presentModalViewController:uinav animated:YES]; </pre> <h2>Optional configurations</h2> You must set these properties before presenting the selector <pre class="prettyprint"> // Turn on/off table index for items, default to NO selector.useTableIndex = YES; // Turn on/off search field at the top of the list, default to NO, only recommend for large list selector.allowSearchControl = YES; // Turn on/off displaying and storing of recent selected items. // recentItemStorageKey : If you have multiple selectors in your app, you need to set different storage key for each of the selectors. // maxNumberOfRecentItems : Defaults to 5. selector.useRecentItems = YES; selector.recentItemStorageKey = @"your_key"; selector.maxNumberOfRecentItems = 5; </pre> <h2>Image caching</h2> If you decide to set <code>imageUrl</code> for your <code>KNSelectorItem</code> items. Then these images will be loaded using <code>SDWebImage</code> library. It will handle image caching and loading automatically.<br><br> <div class="page-header"> <h1>Source code <small>Download and License</small></h1> </div> You can get the full source-code from Github: <a href='https://github.com/kentnguyen/KNMultiItemSelector' target="_blank">github.com/kentnguyen/KNMultiItemSelector</a> <br><br> KNMultiItemSelector is licensed under MIT License 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:<br><br> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.<br><br> 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.<br><br> <div class="page-header"> <h1>Features in the work</h1> </div> <h2>TODO</h2> <ul> <li>Custom UItableViewCell class <li>Custom row height <li>Highlighted search term in result rows <li>More language customization <li>Supports landscape orientation on iPhone <li>Option to use UISegmentedControl to switch modes </ul> <h2>Support</h2> For bug report and suggestions to improve the library, please contact me through my Twitter <a href='http://twitter.com/ntluan' target="_blank">@ntluan</a> or my website <a href="http://kentnguyen.com" target="_blank">kentnguyen.com</a> <br> Don't forget to buy me a coffee ;) <br><br><br> <div id="buymecoffee"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" style='margin-bottom:0'> <input type="hidden" name="cmd" value="_s-xclick"> <table> <tr><td><input type="hidden" name="on0" value="Buy me a coffee if you find it useful"><B>Buy me a coffee if you find it useful</b></td></tr><tr><td><select name="os0"> <option value="1 Cup">1 Cup $5.00 USD</option> <option value="2 Cups" selected>2 Cups $10.00 USD</option> <option value="3 Cups">3 Cups $15.00 USD</option> <option value="4 Cups">4 Cups $20.00 USD</option> <option value="5 Cups">5 Cups $25.00 USD</option> <option value="Go get something nice">Go get something nice $50.00 USD</option> </select> </td></tr> </table> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIIgQYJKoZIhvcNAQcEoIIIcjCCCG4CAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCE1F2bLzBiRpp1nsFfCwHEX3bUiK3b80R7rnDjEOPnO1pV3oBOA8bC0cq8j0JBiVa+2gigOm8DX1BrAx7jGhNBm6NCFB6u9339rjYaW9eWR03O/El+53LR2Qkkt7YDBzYxMR7HvpcJ0a6i5MAtPRnyh1D6bNgrADMRJy099PbmBTELMAkGBSsOAwIaBQAwggH9BgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECEe8+ER4m1r2gIIB2FuON4RuXD7iVIxO3V6pjamdVErfdfoLFqoY2wCCztW9E31YJNwiIelFsKnoMi3eD3M6DcwCGyK1cDmzR4tsZ3WJFEm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6cbRAvN8aq8PUDSsrxG9FXALEMyebZBVfLCIHvhuM4b3mqk7kW15iBl6p8DwT1vO+88WHuBKCwLh8Bs/zcDk3kInDkIb2G7VvECKcYP4Fywt9eb0gjl/Hb5XzUBWHljsSJ1j4Z9o55-----END PKCS7----- "> <input type="image" src="http://kentnguyen.com/KNCoffeeButton210.png" border="0" name="submit" alt="PayPal — The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form> <center><a href="http://kentnguyen.com" target="_blank" style='font-size:10px'>who am i?</a></center> </div> </div> </body> </html>