1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //
- // NavigationBarViewController.m
- // IQKeyboard
- #import "NavigationBarViewController.h"
- #import "IQKeyboardReturnKeyHandler.h"
- #import "IQUIView+IQKeyboardToolbar.h"
- @interface NavigationBarViewController ()<UITextFieldDelegate,UIPopoverPresentationControllerDelegate>
- @end
- @implementation NavigationBarViewController
- {
- IQKeyboardReturnKeyHandler *returnKeyHandler;
- IBOutlet UITextField *textField2;
- IBOutlet UITextField *textField3;
- IBOutlet UIScrollView *scrollView;
- }
- -(void)dealloc
- {
- returnKeyHandler = nil;
- }
- - (void)viewDidLoad
- {
- [super viewDidLoad];
-
- textField3.placeholderText = @"This is the customised placeholder title for displaying as toolbar title";
-
- returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];
- [returnKeyHandler setLastTextFieldReturnKeyType:UIReturnKeyDone];
- }
- -(void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- }
- - (IBAction)enableScrollAction:(UISwitch *)sender {
-
- scrollView.scrollEnabled = sender.on;
- }
- - (IBAction)shouldHideTitle:(UISwitch *)sender
- {
- textField2.shouldHideTitle = !textField2.shouldHideTitle;
- }
- -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
- {
- if ([segue.identifier isEqualToString:@"SettingsNavigationController"])
- {
- segue.destinationViewController.modalPresentationStyle = UIModalPresentationPopover;
- segue.destinationViewController.popoverPresentationController.barButtonItem = sender;
-
- CGFloat heightWidth = MAX(CGRectGetWidth([[UIScreen mainScreen] bounds]), CGRectGetHeight([[UIScreen mainScreen] bounds]));
- segue.destinationViewController.preferredContentSize = CGSizeMake(heightWidth, heightWidth);
- segue.destinationViewController.popoverPresentationController.delegate = self;
- }
- }
- - (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller
- {
- return UIModalPresentationNone;
- }
- -(void)prepareForPopoverPresentation:(UIPopoverPresentationController *)popoverPresentationController
- {
- [self.view endEditing:YES];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- return YES;
- }
- - (BOOL)shouldAutorotate
- {
- return YES;
- }
- - (IBAction)textFieldClicked:(UITextField *)sender
- {
- // [[[UIAlertView alloc] initWithTitle:@"Message" message:@"New Message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];
- }
- @end
|