Merge pull request #806 from jimmyti/master

Fixed selector action sheet to use the row's value transformer
This commit is contained in:
Mathias Claassen
2016-06-24 09:54:33 -03:00
committed by GitHub
+10 -1
View File
@@ -266,7 +266,16 @@
alertController.popoverPresentationController.sourceRect = [formViewController.tableView convertRect:v.frame fromView:self];
__weak __typeof(self)weakSelf = self;
for (id option in self.rowDescriptor.selectorOptions) {
[alertController addAction:[UIAlertAction actionWithTitle:[option displayText]
NSString *optionTitle = [option displayText];
if (self.rowDescriptor.valueTransformer){
NSAssert([self.rowDescriptor.valueTransformer isSubclassOfClass:[NSValueTransformer class]], @"valueTransformer is not a subclass of NSValueTransformer");
NSValueTransformer * valueTransformer = [self.rowDescriptor.valueTransformer new];
NSString * transformedValue = [valueTransformer transformedValue:[option valueData]];
if (transformedValue) {
optionTitle = transformedValue;
}
}
[alertController addAction:[UIAlertAction actionWithTitle:optionTitle
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[weakSelf.rowDescriptor setValue:option];