We're really excited to announce that STV 3.2 is finally out!
STV 3.2 is almost like a major version upgrade if you consider the amount of new features it brings to the STV series. As a matter of fact, it's probably the most feature packed minor version release we've ever had! Let's have a look at some of its awesome new features:
• UISearchDisplayController Support
STV now natively supports displaying a UISearchDisplayController during it's automatic search. To enable this in your projects, simply set the new enableSearchDisplayController property to TRUE and STV will take care of everything else!
• SCSearchViewController
We've created a new SCViewController subclass called SCSearchViewController. The new view controller automatically provides a UISearchBar control, which saves you the hassle of having to create one yourself when using STV's automatic search features. Using this new class, you can start doing stuff like:
SCSearchViewController *mySearchVC = [[SCSearchViewController alloc] init]; mySearchVC.tableViewModel = myTasksModel; [self.navigationController pushViewController:mySearchVC animated:YES];
and that's it, the above code is all you now need to provide automatic search functionality for your models! Here is what this new feature combined with our UISearchDisplayController support looks like on our own Custom Cells App:
SCSearchViewController.png 97.37K
175 downloads
• SCObjectSelectionModel
We've now added support for creating object selection models via our new SCObjectSelectionModel class. Using this new class, you'll be able to have your app users automatically categorize and search for objects while selecting them! To have STV use the new class for it's automatically generated selection detail view, simply pass it on in the detailViewController cell action:
myObjSelectionPropertyDef.cellActions.detailViewController = ^UIViewController*(SCTableViewCell *cell, NSIndexPath *indexPath) { SCObjectSelectionModel *objSelectionModel = [SCObjectSelectionModel modelWithTableView:nil]; // categorize using the first character of the object's title objSelectionModel.modelActions.sectionHeaderTitleForItem = ^NSString*(SCArrayOfItemsModel *itemsModel, NSObject *item, NSUInteger itemIndex) { NSString *objectTitle = (NSString *)[item valueForKey:@"title"]; // Return first charcter of objectTitle return [[objectTitle substringToIndex:1] uppercaseString]; }; // Yes, this too makes use of our awesome new SCSearchViewController! <img src='http://sensiblecocoa.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' /> SCSearchViewController *selectionSearchVC = [[SCSearchViewController alloc] init]; selectionSearchVC.tableViewModel = objSelectionModel; return selectionSearchVC; };
• Themes Layout Control
Not only can your beloved themes feature control the 'skinning' of your app, but it can now also control how every single view is laid out! This is tremendously useful when styling table view cells for example, since you can now resize labels or move text fields around using a single really trivial theme file!
To achieve this, we had to re-engineer the theming system and have it kick in at several stages during a cell's life cycle (as you probably know, cell layout for example is only effective inside layoutSubviews). We've also had to add support the CGRect and CGSize data types in the theme file. To give you an example of how powerful this new feature is, here is all the theme code you need to reposition a cell's textLabel and have it drop a dark shadow:
SCTableViewCell { textLabel.frame: CGRect(10,10,150,30); textLabel.shadowColor: darkGrayColor; textLabel.shadowOffset: CGSize(1,1); }
• Sensible Key Path!
We're all aware of how to access properties deep down the object hierarchy using the valueForKeyPath method. For example, to access a customer's address street name, you'd typically code:
street = [myCustomerObject valueForKeyPath:@"address.street"];
STV has always fully supported this, and will automatically display cell data based on your key path setting. However, a lot of the times you simply cannot use this technique because there is an array in the middle, and Apple's own valueForKeyPath method does not support having an array in the middle of your key path. With our new STV 3.2, we've actually introduced our own key path method that does support arrays! With our new method, you could easily call any of the following:
firstInvoiceDate = [myCustomerObject valueForSensibleKeyPath:@"salesData.invoices[0].date"]; lastInvoiceDate = [myCustomerObject valueForSensibleKeyPath:@"salesData.invoices[n].date"]; beforeLastInvoiceDate = [myCustomerObject valueForSensibleKeyPath:@"salesData.invoices[n-1].date"]; //etc.
This new feature becomes especially essential when you're dealing with web services, as many web services return the value you want STV to automatically fetch deep inside an array or even two in its response JSON object. For example, the YouTube search web service returns three video thumbnails in an array, so you'll then need to tell STV exactly which thumbnail to display using the super convenient bindings string. Using this new feature, the bindings string can now look like this:
// Automatically fetch and display the video's thumbnail, title, and description NSString *bindingsString = @"1:media$group.media$thumbnail[1].url; 2:media$group.media$title.$t; 3:media$group.media$description.$t";
To see this in action, you can download the full YouTube web services app here. (requires the STV+WebServices framework)
This is a screen shot of the app
YouTube.png 157.41K
159 downloads
• New Web Services Features
STV web services binding has quickly gained amazing popularity amongst the STV user community! Usually with only a single page of code, we're able to have STV automatically talk to the web service and display its results in our own custom cells (again, the YouTube app is an excellent example). We've now pushed this a little bit further with these new features:
- STV now natively supports automatically encoding the username and password using Base64 encoding, and will automatically set the authorization headers for HTTP basic authentication.
- STV now natively supports token authentication.
- STV now supports an additional web services batching system where the batch start index can be specified (useful for batching from web services like YouTube and several others who don't return a next batch URL).
- Object editing is now optimized to only update the web service store if the edited object has really changed (even if the user taps Done).
Please leave us your feedback on the new release, we highly appreciate all your input.
Thank you very much for all your support!