|
@@ -44,7 +44,9 @@
|
|
|
if ([self.availableFonts indexOfObject:inputValue] == NSNotFound) {
|
|
if ([self.availableFonts indexOfObject:inputValue] == NSNotFound) {
|
|
|
[self.availableFonts insertObject:inputValue atIndex:0];
|
|
[self.availableFonts insertObject:inputValue atIndex:0];
|
|
|
}
|
|
}
|
|
|
|
|
+#if !TARGET_OS_TV
|
|
|
[(UIPickerView *)self.inputTextView.inputView selectRow:[self.availableFonts indexOfObject:inputValue] inComponent:0 animated:NO];
|
|
[(UIPickerView *)self.inputTextView.inputView selectRow:[self.availableFonts indexOfObject:inputValue] inComponent:0 animated:NO];
|
|
|
|
|
+#endif
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (id)inputValue {
|
|
- (id)inputValue {
|
|
@@ -53,14 +55,6 @@
|
|
|
|
|
|
|
|
#pragma mark - private
|
|
#pragma mark - private
|
|
|
|
|
|
|
|
-- (UIPickerView*)createFontsPicker {
|
|
|
|
|
- UIPickerView *fontsPicker = [UIPickerView new];
|
|
|
|
|
- fontsPicker.dataSource = self;
|
|
|
|
|
- fontsPicker.delegate = self;
|
|
|
|
|
- fontsPicker.showsSelectionIndicator = YES;
|
|
|
|
|
- return fontsPicker;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
- (void)createAvailableFonts {
|
|
- (void)createAvailableFonts {
|
|
|
NSMutableArray<NSString *> *unsortedFontsArray = [NSMutableArray new];
|
|
NSMutableArray<NSString *> *unsortedFontsArray = [NSMutableArray new];
|
|
|
for (NSString *eachFontFamily in UIFont.familyNames) {
|
|
for (NSString *eachFontFamily in UIFont.familyNames) {
|
|
@@ -71,6 +65,16 @@
|
|
|
self.availableFonts = [NSMutableArray arrayWithArray:[unsortedFontsArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]];
|
|
self.availableFonts = [NSMutableArray arrayWithArray:[unsortedFontsArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !TARGET_OS_TV
|
|
|
|
|
+
|
|
|
|
|
+- (UIPickerView*)createFontsPicker {
|
|
|
|
|
+ UIPickerView *fontsPicker = [UIPickerView new];
|
|
|
|
|
+ fontsPicker.dataSource = self;
|
|
|
|
|
+ fontsPicker.delegate = self;
|
|
|
|
|
+ fontsPicker.showsSelectionIndicator = YES;
|
|
|
|
|
+ return fontsPicker;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#pragma mark - UIPickerViewDataSource
|
|
#pragma mark - UIPickerViewDataSource
|
|
|
|
|
|
|
|
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
|
|
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
|
|
@@ -104,4 +108,6 @@
|
|
|
self.inputTextView.text = self.availableFonts[row];
|
|
self.inputTextView.text = self.availableFonts[row];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|