diff --git a/src/iOS.Extension/AddSiteViewController.cs b/src/iOS.Extension/AddSiteViewController.cs index 6739377cb..923e3f8e1 100644 --- a/src/iOS.Extension/AddSiteViewController.cs +++ b/src/iOS.Extension/AddSiteViewController.cs @@ -33,6 +33,7 @@ namespace Bit.iOS.Extension { tableView.RowHeight = UITableView.AutomaticDimension; tableView.EstimatedRowHeight = 44; + tableView.Source = new TableSource (this); base.ViewDidLoad(); } @@ -46,5 +47,64 @@ namespace Bit.iOS.Extension { DismissViewController(true, null); } + + public class TableSource : UITableViewSource + { + private AddSiteViewController _controller; + + public TableSource (AddSiteViewController controller) + { + _controller = controller; + } + + public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) + { + if (indexPath.Row == 0) { + return _controller.nameCell; + } else if (indexPath.Row == 1) { + return _controller.uriCell; + } else if (indexPath.Row == 2) { + return _controller.usernameCell; + } else if (indexPath.Row == 3) { + return _controller.passwordCell; + } else if (indexPath.Row == 4) { + return _controller.generatePasswordCell; + } + + return new UITableViewCell(); + } + + public override nfloat GetHeightForRow (UITableView tableView, NSIndexPath indexPath) + { + return UITableView.AutomaticDimension; + } + + public override nint RowsInSection (UITableView tableview, nint section) + { + if (section == 0) { + return 5; + } else if (section == 1) { + return 2; + } else { + return 1; + } + } + + public override nfloat GetHeightForHeader (UITableView tableView, nint section) + { + return UITableView.AutomaticDimension; + } + + public override string TitleForHeader (UITableView tableView, nint section) + { + if (section == 0) { + return "Site Information"; + } else if (section == 2) { + return "Notes"; + } + + return " "; + } + } } } diff --git a/src/iOS.Extension/AddSiteViewController.designer.cs b/src/iOS.Extension/AddSiteViewController.designer.cs index 59425678e..5c2719588 100644 --- a/src/iOS.Extension/AddSiteViewController.designer.cs +++ b/src/iOS.Extension/AddSiteViewController.designer.cs @@ -1,61 +1,102 @@ -// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Bit.iOS.Extension -{ - [Register ("AddSiteViewController")] - partial class AddSiteViewController - { - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UITableViewCell nameCell { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UITextField nameField { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UILabel nameLabel { get; set; } - - [Outlet] - [GeneratedCode ("iOS Designer", "1.0")] - UITableView tableView { get; set; } - - [Action ("UIBarButtonItem2289_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void UIBarButtonItem2289_Activated (UIBarButtonItem sender); - - [Action ("UIBarButtonItem2290_Activated:")] - [GeneratedCode ("iOS Designer", "1.0")] - partial void UIBarButtonItem2290_Activated (UIBarButtonItem sender); - - void ReleaseDesignerOutlets () - { - if (nameCell != null) { - nameCell.Dispose (); - nameCell = null; - } - if (nameField != null) { - nameField.Dispose (); - nameField = null; - } - if (nameLabel != null) { - nameLabel.Dispose (); - nameLabel = null; - } - if (tableView != null) { - tableView.Dispose (); - tableView = null; - } - } - } -} +// WARNING +// +// This file has been generated automatically by Xamarin Studio from the outlets and +// actions declared in your storyboard file. +// Manual changes to this file will not be maintained. +// +using Foundation; +using System; +using System.CodeDom.Compiler; +using UIKit; + +namespace Bit.iOS.Extension +{ + [Register ("AddSiteViewController")] + partial class AddSiteViewController + { + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITableViewCell generatePasswordCell { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITableViewCell nameCell { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITextField nameField { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UILabel nameLabel { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITableViewCell passwordCell { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITableView tableView { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITableViewCell uriCell { get; set; } + + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UITableViewCell usernameCell { get; set; } + + + [Action ("UIBarButtonItem2289_Activated:")] + [GeneratedCode ("iOS Designer", "1.0")] + partial void UIBarButtonItem2289_Activated (UIBarButtonItem sender); + + + [Action ("UIBarButtonItem2290_Activated:")] + [GeneratedCode ("iOS Designer", "1.0")] + partial void UIBarButtonItem2290_Activated (UIBarButtonItem sender); + + void ReleaseDesignerOutlets () + { + if (generatePasswordCell != null) { + generatePasswordCell.Dispose (); + generatePasswordCell = null; + } + + if (nameCell != null) { + nameCell.Dispose (); + nameCell = null; + } + + if (nameField != null) { + nameField.Dispose (); + nameField = null; + } + + if (nameLabel != null) { + nameLabel.Dispose (); + nameLabel = null; + } + + if (passwordCell != null) { + passwordCell.Dispose (); + passwordCell = null; + } + + if (tableView != null) { + tableView.Dispose (); + tableView = null; + } + + if (uriCell != null) { + uriCell.Dispose (); + uriCell = null; + } + + if (usernameCell != null) { + usernameCell.Dispose (); + usernameCell = null; + } + } + } +} \ No newline at end of file diff --git a/src/iOS.Extension/MainInterface.storyboard b/src/iOS.Extension/MainInterface.storyboard index 62143266f..23f9d3746 100644 --- a/src/iOS.Extension/MainInterface.storyboard +++ b/src/iOS.Extension/MainInterface.storyboard @@ -137,7 +137,7 @@ @@ -154,7 +154,7 @@ - + @@ -175,7 +175,7 @@ - + @@ -203,22 +203,22 @@ - - + + - + - - - + + - - + + + + + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + - + @@ -281,7 +353,7 @@ - + @@ -289,7 +361,7 @@ - + @@ -301,7 +373,7 @@ - + @@ -332,6 +404,10 @@ + + + + @@ -342,7 +418,6 @@ - \ No newline at end of file