diff options
author | Vitaly Takmazov | 2018-04-02 00:31:43 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-02 00:31:43 +0300 |
commit | f153a400634d4aa726dafd2257921b904c92824b (patch) | |
tree | 51ed90b89ccd0eebc4abc85a2e888b65009d34a1 /Juick/ViewControllers | |
parent | c623f12b2d5e95708a3971e642410c9098f71285 (diff) |
multiple fixes
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 3 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 15 | ||||
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 24 |
3 files changed, 19 insertions, 23 deletions
diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index 4f89814..d40dd95 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -20,7 +20,8 @@ - (void)viewDidLoad { [super viewDidLoad]; - [self.navigationController.visibleViewController setTitle:@"Chats"]; + [self.tabBarItem setTitle:@"Chats"]; + self.navigationController.visibleViewController.navigationItem.title = @"Chats"; [self.view setBackgroundColor:[ColorScheme mainBackground]]; [self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"]; self.chats = [NSMutableArray array]; diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m index 11010ae..3b01297 100644 --- a/Juick/ViewControllers/DiscoverViewController.m +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -28,7 +28,8 @@ AppDelegate *appDelegate; if (success) { if ([self.path length] == 0) { self.path = [APIClient feedUrl]; - [self.navigationController.visibleViewController setTitle:@"My feed"]; + [self.tabBarItem setTitle:@"My feed"]; + self.navigationController.visibleViewController.navigationItem.title = @"My feed"; } [self refreshData:NO]; } else { @@ -39,7 +40,8 @@ AppDelegate *appDelegate; } else { if ([self.path length] == 0) { self.path = [APIClient messagesUrl]; - [self.navigationController.visibleViewController setTitle:@"Discover"]; + [self.tabBarItem setTitle:@"Discover"]; + self.navigationController.visibleViewController.navigationItem.title = @"Discover"; } [self refreshData:NO]; } @@ -81,24 +83,27 @@ AppDelegate *appDelegate; UIAlertController *filterAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"My feed" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [self.navigationController.visibleViewController setTitle:@"My feed"]; self.path = [APIClient feedUrl]; + [self.tabBarItem setTitle:@"My feed"]; + self.navigationController.visibleViewController.navigationItem.title = @"My feed"; self.params = nil; [self.messages removeAllObjects]; [self.tableView reloadData]; [self refreshData:NO]; }]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Discover" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [self.navigationController.visibleViewController setTitle:@"Discover"]; self.path = [APIClient messagesUrl]; + [self.tabBarItem setTitle:@"Discover"]; + self.navigationController.visibleViewController.navigationItem.title = @"Discover"; self.params = nil; [self.messages removeAllObjects]; [self.tableView reloadData]; [self refreshData:NO]; }]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Discussions" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [self.navigationController.visibleViewController setTitle:@"Discussions"]; self.path = [APIClient discussionsUrl]; + [self.tabBarItem setTitle:@"Discussions"]; + self.navigationController.visibleViewController.navigationItem.title = @"Discussions"; self.params = nil; [self.messages removeAllObjects]; [self.tableView reloadData]; diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 02d810b..7b80a52 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -31,35 +31,25 @@ if (_replyTo != nil) { MessageInputView *inputView = (MessageInputView *) self.inputAccessoryView; inputView.quoteText.text = _replyTo.text; - self.navigationController.visibleViewController.title = [NSString stringWithFormat:@"Reply to %@", _replyTo.user.uname]; + self.title = [NSString stringWithFormat:@"Reply to %@", _replyTo.user.uname]; } else { - self.navigationController.visibleViewController.title = @"Post"; + self.title = @"Post"; } - self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target:self action:@selector(cancelCompose)]; - self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send" style:UIBarButtonItemStyleDone target:self action:@selector(doneCompose)]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; [self.textView becomeFirstResponder]; } -- (void) cancelCompose { - [self.textView resignFirstResponder]; - [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; -} - -- (void) doneCompose { +- (IBAction)sendAction:(id)sender { if (_replyTo == nil) { [[APIClient sharedClient] postMessage:self.textView.text result:^(Message *msg, NSError *err) { - [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; - MessagesViewController *target = (MessagesViewController *)self.navigationController.visibleViewController; - [target refreshData:YES]; + [self.navigationController popViewControllerAnimated:YES]; + [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES]; }]; } else { [[APIClient sharedClient] postReplyToThread:_replyTo.mid inReplyTo:_replyTo.rid text:self.textView.text result:^(Message *msg, NSError *err) { - [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; - MessagesViewController *target = (MessagesViewController *)self.navigationController.visibleViewController; - [target refreshData:YES]; + [self.navigationController popViewControllerAnimated:YES]; + [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES]; }]; } } |