@@ -13,8 +13,6 @@ namespace CodeHub.iOS.Views.Accounts
1313{
1414 public partial class AddAccountView : MvxViewController
1515 {
16- private readonly IHud _hud ;
17-
1816 public new AddAccountViewModel ViewModel
1917 {
2018 get { return ( AddAccountViewModel ) base . ViewModel ; }
@@ -24,28 +22,29 @@ public partial class AddAccountView : MvxViewController
2422 public AddAccountView ( )
2523 : base ( "AddAccountView" , null )
2624 {
27- Title = "Login" . t ( ) ;
28- NavigationItem . LeftBarButtonItem = new UIBarButtonItem ( Theme . CurrentTheme . BackButton , UIBarButtonItemStyle . Plain , ( s , e ) => NavigationController . PopViewController ( true ) ) ;
29- _hud = this . CreateHud ( ) ;
3025 }
3126
3227 public override void ViewDidLoad ( )
3328 {
29+ base . ViewDidLoad ( ) ;
30+
31+ var hud = this . CreateHud ( ) ;
32+
33+ Title = "Login" ;
34+
3435 var set = this . CreateBindingSet < AddAccountView , AddAccountViewModel > ( ) ;
3536 set . Bind ( User ) . To ( x => x . Username ) ;
3637 set . Bind ( Password ) . To ( x => x . Password ) ;
3738 set . Bind ( Domain ) . To ( x => x . Domain ) ;
38- set . Bind ( LoginButton ) . To ( x => x . LoginCommand ) ;
39- set . Apply ( ) ;
40-
41- base . ViewDidLoad ( ) ;
39+ set . Bind ( LoginButton ) . To ( x => x . LoginCommand ) ;
40+ set . Apply ( ) ;
4241
4342 ViewModel . Bind ( x => x . IsLoggingIn , x =>
4443 {
4544 if ( x )
46- _hud . Show ( "Logging in..." ) ;
45+ hud . Show ( "Logging in..." ) ;
4746 else
48- _hud . Hide ( ) ;
47+ hud . Hide ( ) ;
4948 } ) ;
5049
5150 View . BackgroundColor = UIColor . FromRGB ( 239 , 239 , 244 ) ;
@@ -105,6 +104,13 @@ public override void ViewWillAppear(bool animated)
105104 base . ViewWillAppear ( animated ) ;
106105 _hideNotification = NSNotificationCenter . DefaultCenter . AddObserver ( UIKeyboard . WillHideNotification , OnKeyboardNotification ) ;
107106 _showNotification = NSNotificationCenter . DefaultCenter . AddObserver ( UIKeyboard . WillShowNotification , OnKeyboardNotification ) ;
107+ NavigationItem . LeftBarButtonItem = new UIBarButtonItem ( Theme . CurrentTheme . BackButton , UIBarButtonItemStyle . Plain , ( s , e ) => NavigationController . PopViewController ( true ) ) ;
108+ }
109+
110+ public override void ViewDidDisappear ( bool animated )
111+ {
112+ base . ViewDidDisappear ( animated ) ;
113+ NavigationItem . LeftBarButtonItem = null ;
108114 }
109115
110116 public override void ViewWillDisappear ( bool animated )
0 commit comments