mirror of
https://github.com/HackPlan/IQKeyboardManager.git
synced 2026-03-26 06:54:36 +08:00
Adopted subscript syntax
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>4.0.1</string>
|
||||
<string>4.0.2</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
UILabel *labelText = [[UILabel alloc] init];
|
||||
[labelText setTextAlignment:NSTextAlignmentCenter];
|
||||
[labelText setAdjustsFontSizeToFitWidth:YES];
|
||||
[labelText setText:[_ItemListsInternal objectAtIndex:row]];
|
||||
[labelText setText:_ItemListsInternal[row]];
|
||||
labelText.backgroundColor = [UIColor clearColor];
|
||||
|
||||
if (self.isOptionalDropDown && row == 0)
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
|
||||
{
|
||||
[self setSelectedItem:[_ItemListsInternal objectAtIndex:row]];
|
||||
[self setSelectedItem:_ItemListsInternal[row]];
|
||||
}
|
||||
|
||||
#pragma mark - UIDatePicker delegate
|
||||
@@ -211,7 +211,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
self.text = [_ItemListsInternal objectAtIndex:row];
|
||||
self.text = _ItemListsInternal[row];
|
||||
}
|
||||
|
||||
[self.pickerView selectRow:row inComponent:0 animated:animated];
|
||||
@@ -404,7 +404,7 @@
|
||||
|
||||
if (_isOptionalDropDown)
|
||||
{
|
||||
NSArray *array = [NSArray arrayWithObject:@"Select"];
|
||||
NSArray *array = @[@"Select"];
|
||||
_ItemListsInternal = [array arrayByAddingObjectsFromArray:_itemList];
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
{
|
||||
OptionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([OptionTableViewCell class])];
|
||||
|
||||
cell.labelOption.text = [self.options objectAtIndex:indexPath.row];
|
||||
cell.labelOption.text = (self.options)[indexPath.row];
|
||||
|
||||
cell.accessoryType = (indexPath.row == self.selectedIndex) ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
||||
|
||||
|
||||
@@ -33,33 +33,31 @@
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
sectionTitles = [NSArray arrayWithObjects:@"UIKeyboard handling",
|
||||
sectionTitles = @[@"UIKeyboard handling",
|
||||
@"IQToolbar handling",
|
||||
@"UITextView handling",
|
||||
@"UIKeyboard appearance overriding",
|
||||
@"Resign first responder handling",
|
||||
@"UISound handling",
|
||||
@"UIAnimation handling",nil];
|
||||
@"UIAnimation handling"];
|
||||
|
||||
|
||||
keyboardManagerProperties = [NSArray arrayWithObjects:
|
||||
[NSArray arrayWithObjects:@"Enable", @"Keyboard Distance From TextField", @"Prevent Showing Bottom Blank Space",nil],
|
||||
[NSArray arrayWithObjects:@"Enable AutoToolbar",@"Toolbar Manage Behaviour",@"Should Toolbar Uses TextField TintColor",@"Should Show TextField Placeholder",@"Placeholder Font",nil],
|
||||
[NSArray arrayWithObjects:@"Can Adjust TextView",@"Should Fix TextView Clip",nil],
|
||||
[NSArray arrayWithObjects:@"Override Keyboard Appearance",@"UIKeyboard Appearance",nil],
|
||||
[NSArray arrayWithObjects:@"Should Resign On Touch Outside",nil],
|
||||
[NSArray arrayWithObjects:@"Should Play Input Clicks",nil],
|
||||
[NSArray arrayWithObjects:@"Should Adopt Default Keyboard Animation",nil],nil];
|
||||
keyboardManagerProperties = @[@[@"Enable", @"Keyboard Distance From TextField", @"Prevent Showing Bottom Blank Space"],
|
||||
@[@"Enable AutoToolbar",@"Toolbar Manage Behaviour",@"Should Toolbar Uses TextField TintColor",@"Should Show TextField Placeholder",@"Placeholder Font"],
|
||||
@[@"Can Adjust TextView"],
|
||||
@[@"Override Keyboard Appearance",@"UIKeyboard Appearance"],
|
||||
@[@"Should Resign On Touch Outside"],
|
||||
@[@"Should Play Input Clicks"],
|
||||
@[@"Should Adopt Default Keyboard Animation"]];
|
||||
|
||||
|
||||
keyboardManagerPropertyDetails = [NSArray arrayWithObjects:
|
||||
[NSArray arrayWithObjects:@"Enable/Disable IQKeyboardManager",@"Set keyboard distance from textField",@"Prevent to show blank space between UIKeyboard and View",nil],
|
||||
[NSArray arrayWithObjects:@"Automatic add the IQToolbar on UIKeyboard",@"AutoToolbar previous/next button managing behaviour",@"Uses textField's tintColor property for IQToolbar",@"Add the textField's placeholder text on IQToolbar",@"UIFont for IQToolbar placeholder text",nil],
|
||||
[NSArray arrayWithObjects:@"Adjust textView's frame when it is too big in height",@"Adjust textView's contentInset to fix a bug",nil],
|
||||
[NSArray arrayWithObjects:@"Override the keyboardAppearance for all UITextField/UITextView",@"All the UITextField keyboardAppearance is set using this property",nil],
|
||||
[NSArray arrayWithObjects:@"Resigns Keyboard on touching outside of UITextField/View",nil],
|
||||
[NSArray arrayWithObjects:@"Plays inputClick sound on next/previous/done click",nil],
|
||||
[NSArray arrayWithObjects:@"Uses keyboard default animation curve style to move view",nil],nil];
|
||||
keyboardManagerPropertyDetails = @[@[@"Enable/Disable IQKeyboardManager",@"Set keyboard distance from textField",@"Prevent to show blank space between UIKeyboard and View"],
|
||||
@[@"Automatic add the IQToolbar on UIKeyboard",@"AutoToolbar previous/next button managing behaviour",@"Uses textField's tintColor property for IQToolbar",@"Add the textField's placeholder text on IQToolbar",@"UIFont for IQToolbar placeholder text"],
|
||||
@[@"Adjust textView's frame when it is too big in height"],
|
||||
@[@"Override the keyboardAppearance for all UITextField/UITextView",@"All the UITextField keyboardAppearance is set using this property"],
|
||||
@[@"Resigns Keyboard on touching outside of UITextField/View"],
|
||||
@[@"Plays inputClick sound on next/previous/done click"],
|
||||
@[@"Uses keyboard default animation curve style to move view"]];
|
||||
}
|
||||
|
||||
- (IBAction)doneAction:(UIBarButtonItem *)sender
|
||||
@@ -79,7 +77,7 @@
|
||||
- (void)keyboardDistanceFromTextFieldAction:(UIStepper *)sender
|
||||
{
|
||||
[[IQKeyboardManager sharedManager] setKeyboardDistanceFromTextField:sender.value];
|
||||
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
|
||||
- (void)preventShowingBottomBlankSpaceAction:(UISwitch *)sender
|
||||
@@ -100,9 +98,7 @@
|
||||
|
||||
- (void)shouldToolbarUsesTextFieldTintColorAction:(UISwitch *)sender
|
||||
{
|
||||
#ifdef NSFoundationVersionNumber_iOS_6_1
|
||||
[[IQKeyboardManager sharedManager] setShouldToolbarUsesTextFieldTintColor:sender.on];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)shouldShowTextFieldPlaceholder:(UISwitch *)sender
|
||||
@@ -119,13 +115,6 @@
|
||||
[[IQKeyboardManager sharedManager] setCanAdjustTextView:sender.on];
|
||||
}
|
||||
|
||||
- (void)shouldFixTextViewClipwAction:(UISwitch *)sender
|
||||
{
|
||||
#ifdef NSFoundationVersionNumber_iOS_6_1
|
||||
[[IQKeyboardManager sharedManager] setShouldFixTextViewClip:sender.on];
|
||||
#endif
|
||||
}
|
||||
|
||||
/** "Keyboard appearance overriding */
|
||||
|
||||
- (void)overrideKeyboardAppearanceAction:(UISwitch *)sender
|
||||
@@ -170,7 +159,7 @@
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
return ([[IQKeyboardManager sharedManager] isEnabled] == NO) ? 1: [[keyboardManagerProperties objectAtIndex:section] count];
|
||||
return ([[IQKeyboardManager sharedManager] isEnabled] == NO) ? 1: [keyboardManagerProperties[section] count];
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -185,20 +174,20 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
return [[keyboardManagerProperties objectAtIndex:section] count];
|
||||
return [keyboardManagerProperties[section] count];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
return ([[IQKeyboardManager sharedManager] overrideKeyboardAppearance] == NO) ? 1: [[keyboardManagerProperties objectAtIndex:section] count];
|
||||
return ([[IQKeyboardManager sharedManager] overrideKeyboardAppearance] == NO) ? 1: [keyboardManagerProperties[section] count];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return [[keyboardManagerProperties objectAtIndex:section] count];
|
||||
return [keyboardManagerProperties[section] count];
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -209,7 +198,7 @@
|
||||
|
||||
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return [sectionTitles objectAtIndex:section];
|
||||
return sectionTitles[section];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
@@ -224,8 +213,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] isEnabled];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(enableAction:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -235,8 +224,8 @@
|
||||
case 1:
|
||||
{
|
||||
StepperTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([StepperTableViewCell class])];
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.stepper.value = [[IQKeyboardManager sharedManager] keyboardDistanceFromTextField];
|
||||
cell.labelStepperValue.text = [NSString stringWithFormat:@"%.0f",[[IQKeyboardManager sharedManager] keyboardDistanceFromTextField]];
|
||||
[cell.stepper removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
@@ -248,8 +237,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] preventShowingBottomBlankSpace];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(preventShowingBottomBlankSpaceAction:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -267,8 +256,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] isEnableAutoToolbar];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(enableAutoToolbarAction:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -278,8 +267,8 @@
|
||||
case 1:
|
||||
{
|
||||
NavigationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([NavigationTableViewCell class])];
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
@@ -287,15 +276,11 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
|
||||
#ifdef NSFoundationVersionNumber_iOS_6_1
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] shouldToolbarUsesTextFieldTintColor];
|
||||
#else
|
||||
cell.switchEnable.on = NO;
|
||||
cell.switchEnable.enabled = NO;
|
||||
#endif
|
||||
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(shouldToolbarUsesTextFieldTintColorAction:) forControlEvents:UIControlEventValueChanged];
|
||||
return cell;
|
||||
@@ -305,8 +290,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] shouldShowTextFieldPlaceholder];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(shouldShowTextFieldPlaceholder:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -316,8 +301,8 @@
|
||||
case 4:
|
||||
{
|
||||
NavigationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([NavigationTableViewCell class])];
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
@@ -332,32 +317,14 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] canAdjustTextView];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(canAdjustTextViewAction:) forControlEvents:UIControlEventValueChanged];
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
|
||||
#ifdef NSFoundationVersionNumber_iOS_6_1
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] shouldFixTextViewClip];
|
||||
#else
|
||||
cell.switchEnable.on = NO;
|
||||
cell.switchEnable.enabled = NO;
|
||||
#endif
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(shouldFixTextViewClipwAction:) forControlEvents:UIControlEventValueChanged];
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -369,8 +336,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] overrideKeyboardAppearance];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(overrideKeyboardAppearanceAction:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -380,8 +347,8 @@
|
||||
case 1:
|
||||
{
|
||||
NavigationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([NavigationTableViewCell class])];
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
break;
|
||||
@@ -396,8 +363,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] shouldResignOnTouchOutside];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(shouldResignOnTouchOutsideAction:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -415,8 +382,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] shouldPlayInputClicks];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(shouldPlayInputClicksAction:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -434,8 +401,8 @@
|
||||
{
|
||||
SwitchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SwitchTableViewCell class])];
|
||||
cell.switchEnable.enabled = YES;
|
||||
cell.labelTitle.text = [[keyboardManagerProperties objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelSubtitle.text = [[keyboardManagerPropertyDetails objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row];
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row];
|
||||
cell.switchEnable.on = [[IQKeyboardManager sharedManager] shouldAdoptDefaultKeyboardAnimation];
|
||||
[cell.switchEnable removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];
|
||||
[cell.switchEnable addTarget:self action:@selector(shouldAdoptDefaultKeyboardAnimation:) forControlEvents:UIControlEventValueChanged];
|
||||
@@ -469,16 +436,16 @@
|
||||
if (selectedIndexPathForOptions.section == 1 && selectedIndexPathForOptions.row == 1)
|
||||
{
|
||||
controller.title = @"Toolbar Manage Behaviour";
|
||||
controller.options = [NSArray arrayWithObjects:@"IQAutoToolbar By Subviews",@"IQAutoToolbar By Tag",@"IQAutoToolbar By Position",nil];
|
||||
controller.options = @[@"IQAutoToolbar By Subviews",@"IQAutoToolbar By Tag",@"IQAutoToolbar By Position"];
|
||||
controller.selectedIndex = [[IQKeyboardManager sharedManager] toolbarManageBehaviour];
|
||||
}
|
||||
else if (selectedIndexPathForOptions.section == 1 && selectedIndexPathForOptions.row == 4)
|
||||
{
|
||||
controller.title = @"Fonts";
|
||||
|
||||
controller.options = [NSArray arrayWithObjects:@"Bold System Font",@"Italic system font",@"Regular",nil];
|
||||
controller.options = @[@"Bold System Font",@"Italic system font",@"Regular"];
|
||||
|
||||
NSArray *fonts = [NSArray arrayWithObjects:[UIFont boldSystemFontOfSize:12.0],[UIFont italicSystemFontOfSize:12],[UIFont systemFontOfSize:12],nil];
|
||||
NSArray *fonts = @[[UIFont boldSystemFontOfSize:12.0],[UIFont italicSystemFontOfSize:12],[UIFont systemFontOfSize:12]];
|
||||
|
||||
UIFont *placeholderFont = [[IQKeyboardManager sharedManager] placeholderFont];
|
||||
|
||||
@@ -490,7 +457,7 @@
|
||||
else if (selectedIndexPathForOptions.section == 3 && selectedIndexPathForOptions.row == 1)
|
||||
{
|
||||
controller.title = @"Keyboard Appearance";
|
||||
controller.options = [NSArray arrayWithObjects:@"UIKeyboardAppearance Default",@"UIKeyboardAppearance Dark",@"UIKeyboardAppearance Light",nil];
|
||||
controller.options = @[@"UIKeyboardAppearance Default",@"UIKeyboardAppearance Dark",@"UIKeyboardAppearance Light"];
|
||||
controller.selectedIndex = [[IQKeyboardManager sharedManager] keyboardAppearance];
|
||||
}
|
||||
}
|
||||
@@ -504,9 +471,9 @@
|
||||
}
|
||||
else if (selectedIndexPathForOptions.section == 1 && selectedIndexPathForOptions.row == 4)
|
||||
{
|
||||
NSArray *fonts = [NSArray arrayWithObjects:[UIFont boldSystemFontOfSize:12.0],[UIFont italicSystemFontOfSize:12],[UIFont systemFontOfSize:12],nil];
|
||||
NSArray *fonts = @[[UIFont boldSystemFontOfSize:12.0],[UIFont italicSystemFontOfSize:12],[UIFont systemFontOfSize:12]];
|
||||
|
||||
[[IQKeyboardManager sharedManager] setPlaceholderFont:[fonts objectAtIndex:index]];
|
||||
[[IQKeyboardManager sharedManager] setPlaceholderFont:fonts[index]];
|
||||
}
|
||||
else if (selectedIndexPathForOptions.section == 3 && selectedIndexPathForOptions.row == 1)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
UITextField *textField = (UITextField *)[cell.contentView viewWithTag:123];
|
||||
textField.placeholder = [NSString stringWithFormat:@"Cell %@",[NSNumber numberWithInteger:indexPath.row]];
|
||||
textField.placeholder = [NSString stringWithFormat:@"Cell %@",@(indexPath.row)];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
|
||||
[returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];
|
||||
|
||||
[dropDownTextField setItemList:[NSArray arrayWithObjects:@"Zero Line Of Code",
|
||||
[dropDownTextField setItemList:@[@"Zero Line Of Code",
|
||||
@"No More UIScrollView",
|
||||
@"No More Subclasses",
|
||||
@"No More Manual Work",
|
||||
@@ -78,7 +78,7 @@
|
||||
@"Auto adjust textView's height ",
|
||||
@"Adopt tintColor from textField",
|
||||
@"Customize keyboardAppearance",
|
||||
@"play sound on next/prev/done",nil]];
|
||||
@"play sound on next/prev/done"]];
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated
|
||||
@@ -120,10 +120,7 @@
|
||||
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
|
||||
navigationController.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;
|
||||
|
||||
#ifdef NSFoundationVersionNumber_iOS_6_1
|
||||
navigationController.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor;
|
||||
#endif
|
||||
navigationController.navigationBar.titleTextAttributes = self.navigationController.navigationBar.titleTextAttributes;
|
||||
|
||||
[navigationController setModalTransitionStyle:arc4random()%4];
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
[super viewDidLoad];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
_data = [NSArray arrayWithObjects:@"Hello", @"This is a demo code", @"Issue #56", @"With mutiple cells", @"And some useless text.",
|
||||
_data = @[@"Hello", @"This is a demo code", @"Issue #56", @"With mutiple cells", @"And some useless text.",
|
||||
@"Hello", @"This is a demo code", @"Issue #56", @"With mutiple cells", @"And some useless text.",
|
||||
@"Hello", @"This is a demo code", @"Issue #56", @"With mutiple cells", @"And some useless text.",nil];
|
||||
@"Hello", @"This is a demo code", @"Issue #56", @"With mutiple cells", @"And some useless text."];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
@@ -50,7 +50,7 @@
|
||||
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(5,7,135,30)];
|
||||
textView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
|
||||
textView.backgroundColor = [UIColor clearColor];
|
||||
textView.text = [_data objectAtIndex:indexPath.row];
|
||||
textView.text = _data[indexPath.row];
|
||||
textView.dataDetectorTypes = UIDataDetectorTypeAll;
|
||||
textView.scrollEnabled = NO;
|
||||
textView.editable = NO;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>4.0.1</string>
|
||||
<string>4.0.2</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
@@ -21,7 +21,7 @@ class SettingsViewController: UITableViewController, OptionsViewControllerDelega
|
||||
let keyboardManagerProperties = [
|
||||
["Enable", "Keyboard Distance From TextField", "Prevent Showing Bottom Blank Space"],
|
||||
["Enable AutoToolbar","Toolbar Manage Behaviour","Should Toolbar Uses TextField TintColor","Should Show TextField Placeholder","Placeholder Font"],
|
||||
["Can Adjust TextView","Should Fix TextView Clip"],
|
||||
["Can Adjust TextView"],
|
||||
["Override Keyboard Appearance","UIKeyboard Appearance"],
|
||||
["Should Resign On Touch Outside"],
|
||||
["Should Play Input Clicks"],
|
||||
@@ -30,7 +30,7 @@ class SettingsViewController: UITableViewController, OptionsViewControllerDelega
|
||||
let keyboardManagerPropertyDetails = [
|
||||
["Enable/Disable IQKeyboardManager","Set keyboard distance from textField","Prevent to show blank space between UIKeyboard and View"],
|
||||
["Automatic add the IQToolbar on UIKeyboard","AutoToolbar previous/next button managing behaviour","Uses textField's tintColor property for IQToolbar","Add the textField's placeholder text on IQToolbar","UIFont for IQToolbar placeholder text"],
|
||||
["Adjust textView's frame when it is too big in height","Adjust textView's contentInset to fix a bug"],
|
||||
["Adjust textView's frame when it is too big in height"],
|
||||
["Override the keyboardAppearance for all UITextField/UITextView","All the UITextField keyboardAppearance is set using this property"],
|
||||
["Resigns Keyboard on touching outside of UITextField/View"],
|
||||
["Plays inputClick sound on next/previous/done click"],
|
||||
@@ -93,13 +93,6 @@ class SettingsViewController: UITableViewController, OptionsViewControllerDelega
|
||||
self.tableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Fade)
|
||||
}
|
||||
|
||||
func shouldFixTextViewClipAction (sender: UISwitch) {
|
||||
|
||||
IQKeyboardManager.sharedManager().shouldFixTextViewClip = sender.on
|
||||
|
||||
self.tableView.reloadSections(NSIndexSet(index: 3), withRowAnimation: UITableViewRowAnimation.Fade)
|
||||
}
|
||||
|
||||
/** "Keyboard appearance overriding */
|
||||
func overrideKeyboardAppearanceAction (sender: UISwitch) {
|
||||
|
||||
@@ -329,22 +322,6 @@ class SettingsViewController: UITableViewController, OptionsViewControllerDelega
|
||||
cell.switchEnable.addTarget(self, action: #selector(self.canAdjustTextViewAction(_:)), forControlEvents: UIControlEvents.ValueChanged)
|
||||
|
||||
return cell
|
||||
|
||||
case 1:
|
||||
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("SwitchTableViewCell") as! SwitchTableViewCell
|
||||
cell.switchEnable.enabled = true
|
||||
|
||||
cell.labelTitle.text = keyboardManagerProperties[indexPath.section][indexPath.row]
|
||||
cell.labelSubtitle.text = keyboardManagerPropertyDetails[indexPath.section][indexPath.row]
|
||||
|
||||
cell.switchEnable.on = IQKeyboardManager.sharedManager().shouldFixTextViewClip
|
||||
|
||||
cell.switchEnable.removeTarget(nil, action: nil, forControlEvents: UIControlEvents.AllEvents)
|
||||
cell.switchEnable.addTarget(self, action: #selector(self.shouldFixTextViewClipAction(_:)), forControlEvents: UIControlEvents.ValueChanged)
|
||||
|
||||
return cell
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -338,15 +338,6 @@
|
||||
[keyboardDoneButton tap];
|
||||
}
|
||||
|
||||
|
||||
/////--------------------------
|
||||
///// @name UITextView handling
|
||||
/////--------------------------
|
||||
//
|
||||
///**
|
||||
// canAdjustTextView Adjust textView's frame when it is too big in height. Default is NO.
|
||||
// shouldFixTextViewClip Adjust textView's contentInset to fix a bug. for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string Default is YES.
|
||||
// */
|
||||
//- (void)testTextView {
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "IQKeyboardManager",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"source": {
|
||||
"git": "https://github.com/hackiftekhar/IQKeyboardManager.git",
|
||||
"tag": "v4.0.1"
|
||||
"tag": "v4.0.2"
|
||||
},
|
||||
"summary": "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.",
|
||||
"homepage": "https://github.com/hackiftekhar/IQKeyboardManager",
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
/**
|
||||
Returns the array by sorting the UIView's by their tag property.
|
||||
*/
|
||||
- (nonnull NSArray*)sortedArrayByTag;
|
||||
@property (nonatomic, readonly, copy) NSArray * _Nonnull sortedArrayByTag;
|
||||
|
||||
/**
|
||||
Returns the array by sorting the UIView's by their tag property.
|
||||
*/
|
||||
- (nonnull NSArray*)sortedArrayByPosition;
|
||||
@property (nonatomic, readonly, copy) NSArray * _Nonnull sortedArrayByPosition;
|
||||
|
||||
@end
|
||||
|
||||
@@ -64,7 +64,7 @@ Class UISearchBarTextFieldClass; //UISearchBar
|
||||
|
||||
-(void)_setIsAskingCanBecomeFirstResponder:(BOOL)isAskingCanBecomeFirstResponder
|
||||
{
|
||||
objc_setAssociatedObject(self, @selector(isAskingCanBecomeFirstResponder), [NSNumber numberWithBool:isAskingCanBecomeFirstResponder], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(self, @selector(isAskingCanBecomeFirstResponder), @(isAskingCanBecomeFirstResponder), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
-(BOOL)isAskingCanBecomeFirstResponder
|
||||
|
||||
@@ -136,11 +136,6 @@ extern NSInteger const kIQPreviousNextButtonToolbarTag;
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL canAdjustTextView;
|
||||
|
||||
/**
|
||||
Adjust textView's contentInset to fix a bug. for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string Default is YES.
|
||||
*/
|
||||
@property(nonatomic, assign) BOOL shouldFixTextViewClip;
|
||||
|
||||
///---------------------------------------
|
||||
/// @name UIKeyboard appearance overriding
|
||||
///---------------------------------------
|
||||
|
||||
@@ -157,8 +157,6 @@ void _IQShowLog(NSString *logString);
|
||||
//TextView handling
|
||||
@synthesize canAdjustTextView = _canAdjustTextView;
|
||||
|
||||
@synthesize shouldFixTextViewClip = _shouldFixTextViewClip;
|
||||
|
||||
//Resign handling
|
||||
@synthesize shouldResignOnTouchOutside = _shouldResignOnTouchOutside;
|
||||
|
||||
@@ -203,8 +201,6 @@ void _IQShowLog(NSString *logString);
|
||||
[self addTextFieldViewDidBeginEditingNotificationName:UITextViewTextDidBeginEditingNotification
|
||||
didEndEditingNotificationName:UITextViewTextDidEndEditingNotification];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidChange:) name:UITextViewTextDidChangeNotification object:nil];
|
||||
|
||||
// Registering for orientation changes notification
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willChangeStatusBarOrientation:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
|
||||
|
||||
@@ -243,14 +239,13 @@ void _IQShowLog(NSString *logString);
|
||||
strongSelf.enabledTouchResignedClasses = [[NSMutableSet alloc] init];
|
||||
|
||||
[self setShouldToolbarUsesTextFieldTintColor:NO];
|
||||
[self setShouldFixTextViewClip:YES];
|
||||
});
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Automatically called from the `+(void)load` method. */
|
||||
+ (instancetype)sharedManager
|
||||
+ (IQKeyboardManager*)sharedManager
|
||||
{
|
||||
//Singleton instance
|
||||
static IQKeyboardManager *kbManager;
|
||||
@@ -947,7 +942,7 @@ void _IQShowLog(NSString *logString);
|
||||
if (_shouldAdoptDefaultKeyboardAnimation)
|
||||
{
|
||||
// Getting keyboard animation.
|
||||
_animationCurve = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue];
|
||||
_animationCurve = [[aNotification userInfo][UIKeyboardAnimationCurveUserInfoKey] integerValue];
|
||||
_animationCurve = _animationCurve<<16;
|
||||
}
|
||||
else
|
||||
@@ -956,7 +951,7 @@ void _IQShowLog(NSString *logString);
|
||||
}
|
||||
|
||||
// Getting keyboard animation duration
|
||||
CGFloat duration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
CGFloat duration = [[aNotification userInfo][UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
|
||||
//Saving animation duration
|
||||
if (duration != 0.0) _animationDuration = duration;
|
||||
@@ -964,7 +959,7 @@ void _IQShowLog(NSString *logString);
|
||||
CGSize oldKBSize = _kbSize;
|
||||
|
||||
// Getting UIKeyboardSize.
|
||||
CGRect kbFrame = [[[aNotification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
CGRect kbFrame = [[aNotification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
|
||||
CGRect screenSize = [[UIScreen mainScreen] bounds];
|
||||
|
||||
@@ -1013,7 +1008,7 @@ void _IQShowLog(NSString *logString);
|
||||
_isKeyboardShowing = NO;
|
||||
|
||||
// Getting keyboard animation duration
|
||||
CGFloat aDuration = [[[aNotification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
CGFloat aDuration = [[aNotification userInfo][UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
if (aDuration!= 0.0f)
|
||||
{
|
||||
_animationDuration = aDuration;
|
||||
@@ -1275,31 +1270,6 @@ void _IQShowLog(NSString *logString);
|
||||
_IQShowLog([NSString stringWithFormat:@"****** %@ ended ******",NSStringFromSelector(_cmd)]);
|
||||
}
|
||||
|
||||
/** UITextViewTextDidChangeNotificationBug, fix for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string */
|
||||
-(void)textFieldViewDidChange:(NSNotification*)notification // (Bug ID: #18)
|
||||
{
|
||||
if (_shouldFixTextViewClip == YES && _enable == YES)
|
||||
{
|
||||
UITextView *textView = (UITextView *)notification.object;
|
||||
CGRect line = [textView caretRectForPosition: textView.selectedTextRange.start];
|
||||
CGFloat overflow = CGRectGetMaxY(line) - (textView.contentOffset.y + CGRectGetHeight(textView.bounds) - textView.contentInset.bottom - textView.contentInset.top);
|
||||
|
||||
//Added overflow conditions (Bug ID: 95)
|
||||
if ( overflow > 0 && overflow < FLT_MAX)
|
||||
{
|
||||
// We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it)
|
||||
// Scroll caret to visible area
|
||||
CGPoint offset = textView.contentOffset;
|
||||
offset.y += overflow + 7; // leave 7 pixels margin
|
||||
|
||||
// Cannot animate with setContentOffset:animated: or caret will not appear
|
||||
[UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{
|
||||
[textView setContentOffset:offset];
|
||||
} completion:NULL];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UIInterfaceOrientation Change notification methods
|
||||
/** UIApplicationWillChangeStatusBarOrientationNotification. Need to set the textView to it's original position. If any frame changes made. (Bug ID: #92)*/
|
||||
- (void)willChangeStatusBarOrientation:(NSNotification*)aNotification
|
||||
@@ -1433,7 +1403,7 @@ void _IQShowLog(NSString *logString);
|
||||
//If it is not first textField. then it's previous object becomeFirstResponder.
|
||||
if (index != NSNotFound && index > 0)
|
||||
{
|
||||
UITextField *nextTextField = [textFields objectAtIndex:index-1];
|
||||
UITextField *nextTextField = textFields[index-1];
|
||||
|
||||
// Retaining textFieldView
|
||||
UIView *textFieldRetain = _textFieldView;
|
||||
@@ -1469,7 +1439,7 @@ void _IQShowLog(NSString *logString);
|
||||
//If it is not last textField. then it's next object becomeFirstResponder.
|
||||
if (index != NSNotFound && index < textFields.count-1)
|
||||
{
|
||||
UITextField *nextTextField = [textFields objectAtIndex:index+1];
|
||||
UITextField *nextTextField = textFields[index+1];
|
||||
|
||||
// Retaining textFieldView
|
||||
UIView *textFieldRetain = _textFieldView;
|
||||
@@ -1555,7 +1525,7 @@ void _IQShowLog(NSString *logString);
|
||||
UITextField *textField = nil;
|
||||
|
||||
if ([siblings count])
|
||||
textField = [siblings objectAtIndex:0]; //Not using firstObject method because iOS5 doesn't not support 'firstObject' method.
|
||||
textField = siblings[0];
|
||||
|
||||
//Either there is no inputAccessoryView or if accessoryView is not appropriate for current situation(There is Previous/Next/Done toolbar).
|
||||
//setInputAccessoryView: check (Bug ID: #307)
|
||||
@@ -1731,7 +1701,7 @@ void _IQShowLog(NSString *logString);
|
||||
|
||||
//In case of UITableView (Special), the next/previous buttons has to be refreshed everytime. (Bug ID: #56)
|
||||
// If firstTextField, then previous should not be enabled.
|
||||
if ([siblings objectAtIndex:0] == textField)
|
||||
if (siblings[0] == textField)
|
||||
{
|
||||
[textField setEnablePrevious:NO next:YES];
|
||||
}
|
||||
@@ -1777,7 +1747,7 @@ void _IQShowLog(NSString *logString);
|
||||
for (UITextField *textField in siblings)
|
||||
{
|
||||
// If firstTextField, then previous should not be enabled.
|
||||
if ([siblings objectAtIndex:0] == textField)
|
||||
if (siblings[0] == textField)
|
||||
{
|
||||
if (siblings.count == 1)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ NSString *const kIQTextFieldReturnKeyType = @"kIQTextFieldReturnKeyType";
|
||||
-(NSDictionary*)textFieldCachedInfo:(UITextField*)textField
|
||||
{
|
||||
for (NSDictionary *infoDict in textFieldInfoCache)
|
||||
if ([infoDict objectForKey:kIQTextField] == textField) return infoDict;
|
||||
if (infoDict[kIQTextField] == textField) return infoDict;
|
||||
|
||||
return nil;
|
||||
}
|
||||
@@ -99,8 +99,8 @@ NSString *const kIQTextFieldReturnKeyType = @"kIQTextFieldReturnKeyType";
|
||||
|
||||
if (dict)
|
||||
{
|
||||
textField.keyboardType = [[dict objectForKey:kIQTextFieldReturnKeyType] integerValue];
|
||||
textField.delegate = [dict objectForKey:kIQTextFieldDelegate];
|
||||
textField.keyboardType = [dict[kIQTextFieldReturnKeyType] integerValue];
|
||||
textField.delegate = dict[kIQTextFieldDelegate];
|
||||
[textFieldInfoCache removeObject:dict];
|
||||
}
|
||||
}
|
||||
@@ -109,10 +109,10 @@ NSString *const kIQTextFieldReturnKeyType = @"kIQTextFieldReturnKeyType";
|
||||
{
|
||||
NSMutableDictionary *dictInfo = [[NSMutableDictionary alloc] init];
|
||||
|
||||
[dictInfo setObject:textField forKey:kIQTextField];
|
||||
[dictInfo setObject:[NSNumber numberWithInteger:textField.returnKeyType] forKey:kIQTextFieldReturnKeyType];
|
||||
dictInfo[kIQTextField] = textField;
|
||||
dictInfo[kIQTextFieldReturnKeyType] = @(textField.returnKeyType);
|
||||
|
||||
if (textField.delegate) [dictInfo setObject:textField.delegate forKey:kIQTextFieldDelegate];
|
||||
if (textField.delegate) dictInfo[kIQTextFieldDelegate] = textField.delegate;
|
||||
|
||||
[textField setDelegate:self];
|
||||
|
||||
@@ -215,7 +215,7 @@ NSString *const kIQTextFieldReturnKeyType = @"kIQTextFieldReturnKeyType";
|
||||
NSUInteger index = [textFields indexOfObject:textField];
|
||||
|
||||
//If it is not last textField. then it's next object becomeFirstResponder.
|
||||
(index != NSNotFound && index < textFields.count-1) ? [[textFields objectAtIndex:index+1] becomeFirstResponder] : [textField resignFirstResponder];
|
||||
(index != NSNotFound && index < textFields.count-1) ? [textFields[index+1] becomeFirstResponder] : [textField resignFirstResponder];
|
||||
}
|
||||
|
||||
#pragma mark - TextField delegate
|
||||
@@ -359,9 +359,9 @@ NSString *const kIQTextFieldReturnKeyType = @"kIQTextFieldReturnKeyType";
|
||||
{
|
||||
for (NSDictionary *dict in textFieldInfoCache)
|
||||
{
|
||||
UITextField *textField = [dict objectForKey:kIQTextField];
|
||||
textField.keyboardType = [[dict objectForKey:kIQTextFieldReturnKeyType] integerValue];
|
||||
textField.delegate = [dict objectForKey:kIQTextFieldDelegate];
|
||||
UITextField *textField = dict[kIQTextField];
|
||||
textField.keyboardType = [dict[kIQTextFieldReturnKeyType] integerValue];
|
||||
textField.delegate = dict[kIQTextFieldDelegate];
|
||||
}
|
||||
|
||||
[textFieldInfoCache removeAllObjects];
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
-(void)setShouldHideTitle:(BOOL)shouldHideTitle
|
||||
{
|
||||
objc_setAssociatedObject(self, @selector(shouldHideTitle), [NSNumber numberWithBool:shouldHideTitle], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
objc_setAssociatedObject(self, @selector(shouldHideTitle), @(shouldHideTitle), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
|
||||
if ([self respondsToSelector:@selector(placeholder)] && [self.inputAccessoryView respondsToSelector:@selector(setTitle:)])
|
||||
{
|
||||
@@ -662,8 +662,8 @@
|
||||
if ([[inputAccessoryView items] count]>3)
|
||||
{
|
||||
// Getting first item from inputAccessoryView.
|
||||
IQBarButtonItem *prevButton = (IQBarButtonItem*)[[inputAccessoryView items] objectAtIndex:0];
|
||||
IQBarButtonItem *nextButton = (IQBarButtonItem*)[[inputAccessoryView items] objectAtIndex:2];
|
||||
IQBarButtonItem *prevButton = (IQBarButtonItem*)[inputAccessoryView items][0];
|
||||
IQBarButtonItem *nextButton = (IQBarButtonItem*)[inputAccessoryView items][2];
|
||||
|
||||
// If it is UIBarButtonItem and it's customView is not nil.
|
||||
if ([prevButton isKindOfClass:[IQBarButtonItem class]] && [nextButton isKindOfClass:[IQBarButtonItem class]])
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "IQKeyboardManagerSwift",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"source": {
|
||||
"git": "https://github.com/hackiftekhar/IQKeyboardManager.git",
|
||||
"tag": "v4.0.1"
|
||||
"tag": "v4.0.2"
|
||||
},
|
||||
"summary": "Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.",
|
||||
"homepage": "https://github.com/hackiftekhar/IQKeyboardManager",
|
||||
|
||||
@@ -247,12 +247,7 @@ public class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
*/
|
||||
public var canAdjustTextView = false
|
||||
|
||||
/**
|
||||
Adjust textView's contentInset to fix a bug. for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string Default is YES.
|
||||
*/
|
||||
public var shouldFixTextViewClip = true
|
||||
|
||||
|
||||
///---------------------------------------
|
||||
/// MARK: UIKeyboard appearance overriding
|
||||
///---------------------------------------
|
||||
@@ -787,7 +782,6 @@ public class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
|
||||
// Registering for UITextView notification.
|
||||
addTextFieldViewDidBeginEditingNotificationName(UITextViewTextDidBeginEditingNotification, didEndEditingNotificationName: UITextViewTextDidEndEditingNotification)
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.textFieldViewDidChange(_:)), name: UITextViewTextDidChangeNotification, object: nil)
|
||||
|
||||
// Registering for orientation changes notification
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.willChangeStatusBarOrientation(_:)), name: UIApplicationWillChangeStatusBarOrientationNotification, object: nil)
|
||||
@@ -1682,31 +1676,6 @@ public class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
_IQShowLog("****** \(#function) ended ******")
|
||||
}
|
||||
|
||||
/** UITextViewTextDidChangeNotificationBug, fix for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string */
|
||||
internal func textFieldViewDidChange(notification:NSNotification) { // (Bug ID: #18)
|
||||
|
||||
if shouldFixTextViewClip {
|
||||
let textView = notification.object as! UITextView
|
||||
|
||||
let line = textView.caretRectForPosition((textView.selectedTextRange?.start)!)
|
||||
|
||||
let overflow = CGRectGetMaxY(line) - (textView.contentOffset.y + CGRectGetHeight(textView.bounds) - textView.contentInset.bottom - textView.contentInset.top)
|
||||
|
||||
//Added overflow conditions (Bug ID: 95)
|
||||
if overflow > 0.0 && overflow < CGFloat(FLT_MAX) {
|
||||
// We are at the bottom of the visible text and introduced a line feed, scroll down (iOS 7 does not do it)
|
||||
// Scroll caret to visible area
|
||||
var offset = textView.contentOffset
|
||||
offset.y += overflow + 7 // leave 7 pixels margin
|
||||
|
||||
// Cannot animate with setContentOffset:animated: or caret will not appear
|
||||
UIView.animateWithDuration(_animationDuration, delay: 0, options: UIViewAnimationOptions.BeginFromCurrentState.union(_animationCurve), animations: { () -> Void in
|
||||
textView.contentOffset = offset
|
||||
}, completion: { (finished) -> Void in })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///------------------------------------------
|
||||
/// MARK: Interface Orientation Notifications
|
||||
///------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user