Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ViewController.h"
- @interface ViewController () {
- UIBarButtonItem *addButton;
- }
- @end
- @implementation ViewController
- @synthesize tableView;
- @synthesize textField;
- - (void)viewDidLoad {
- [super viewDidLoad];
- addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonPressed:)];
- self.navigationItem.rightBarButtonItem = addButton;
- txtField.hidden = YES;
- }
- - (void)addButtonPressed:(id)sender
- {
- txtField.hidden = NO;
- }
- @end
- #import "ViewController.h"
- @interface ViewController () {
- Bool isShowingTF;
- UIBarButtonItem *addButton;
- }
- @end
- @implementation ViewController
- @synthesize tableView;
- @synthesize textField;
- - (void)viewDidLoad {
- [super viewDidLoad];
- isShowingTF = NO;
- addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonPressed:)];
- self.navigationItem.rightBarButtonItem = addButton;
- txtField.hidden = YES;
- }
- - (void)addButtonPressed:(id)sender
- {
- if (isShowingTF) {
- txtField.hidden = YES;
- } else {
- txtField.hidden = NO;
- }
- isShowingTF = ! isShowingTF;
- }
- @end
- @interface ViewController () {
- UIBarButtonItem *addButton;
- NSString *GettouchStr;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonPressed:)];
- self.navigationItem.rightBarButtonItem = addButton;
- txtField.hidden = YES;
- GettouchStr=@"hidden";
- }
- - (void)addButtonPressed:(id)sender
- {
- if ([GettouchStr isEqualToString:@"hidden"])
- {
- [UIView animateWithDuration:0.3 animations:^{
- txtField.alpha = 1;
- } completion: ^(BOOL finished) {
- txtField.hidden = NO;
- GettouchStr=@"UNhidden";
- }];
- }
- else
- {
- [UIView animateWithDuration:0.3 animations:^{
- txtField.alpha = 0;
- } completion: ^(BOOL finished) {
- txtField.hidden = YES;
- GettouchStr=@"hidden";
- }];
- }
- }
- - (void)addButtonPressed:(id)sender
- {
- if ([GettouchStr isEqualToString:@"hidden"])
- {
- txtField.alpha = 1;
- [UIView animateWithDuration:2.f delay:0.f options:UIViewAnimationOptionCurveEaseIn animations:^{
- txtField.alpha = 0;
- } completion:^(BOOL finished) {
- [UIView animateWithDuration:2.f delay:0.f options:UIViewAnimationOptionCurveEaseInOut animations:^{
- txtField.alpha = 1;
- txtField.hidden = NO;
- GettouchStr=@"UNhidden";
- } completion:nil];
- }];
- }
- else
- {
- txtField.alpha = 0;
- [UIView animateWithDuration:2.f delay:0.f options:UIViewAnimationOptionCurveEaseIn animations:^{
- txtField.alpha = 1;
- } completion:^(BOOL finished) {
- [UIView animateWithDuration:2.f delay:0.f options:UIViewAnimationOptionCurveEaseInOut animations:^{
- txtField.alpha = 0;
- txtField.hidden = YES;
- GettouchStr=@"hidden";
- } completion:nil];
- }];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement