Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iOS: Added new screens, renamed Prototype screen to Player. Added emb…
…edded fonts. Added a generic ListViewController, and more. Related to issue #405. git-svn-id: http://hamster-svn/svn/repos/base@680 765c1f7c-9fb8-954f-9ff8-dd0915cb3117
- Loading branch information
animal
committed
Jan 17, 2013
1 parent
6b27ab8
commit 39ec49f
Showing
26 changed files
with
1,360 additions
and
228 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
MPfm/branches/current/MPfm.iOS/Classes/Controllers/BaseViewController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using MonoTouch.Foundation; | ||
using MonoTouch.UIKit; | ||
using MPfm.MVP; | ||
|
||
namespace MPfm.iOS | ||
{ | ||
public abstract class BaseViewController : UIViewController//, IBaseView | ||
{ | ||
//public Action OnViewDestroy { get; set; } // Is this useful on iOS? | ||
//protected Action<IBaseView> OnViewReady { get; set; } | ||
|
||
public BaseViewController(string nibName, NSBundle bundle) | ||
: base(nibName, bundle) | ||
{ | ||
} | ||
|
||
// public void ShowView(bool shown) | ||
// { | ||
// this.View.Hidden = !shown; | ||
// } | ||
} | ||
} | ||
|
101 changes: 101 additions & 0 deletions
101
MPfm/branches/current/MPfm.iOS/Classes/Controllers/ListViewController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using MonoTouch.Foundation; | ||
using MonoTouch.UIKit; | ||
|
||
namespace MPfm.iOS | ||
{ | ||
public partial class ListViewController : BaseViewController | ||
{ | ||
private UIBarButtonItem btnBack; | ||
private Action<GenericListItem> actionOnItemSelected; | ||
private ListTableViewSource tableViewSource; | ||
private string title; | ||
public List<GenericListItem> Items { get; private set; } | ||
|
||
static bool UserInterfaceIdiomIsPhone | ||
{ | ||
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; } | ||
} | ||
|
||
public ListViewController(string title, List<GenericListItem> items, Action<GenericListItem> actionOnItemSelected) | ||
: base (UserInterfaceIdiomIsPhone ? "ListViewController_iPhone" : "ListViewController_iPad", null) | ||
{ | ||
if (this.TabBarItem != null) | ||
{ | ||
this.TabBarItem.Title = title; | ||
this.TabBarItem.Image = UIImage.FromBundle("Images/Tabs/more"); | ||
} | ||
this.title = title; | ||
this.Items = items; | ||
this.actionOnItemSelected = actionOnItemSelected; | ||
} | ||
|
||
public override void DidReceiveMemoryWarning() | ||
{ | ||
// Releases the view if it doesn't have a superview. | ||
base.DidReceiveMemoryWarning(); | ||
|
||
// Release any cached data, images, etc that aren't in use. | ||
} | ||
|
||
public override void ViewDidLoad() | ||
{ | ||
base.ViewDidLoad(); | ||
|
||
// // Set NavCtrl title if available | ||
// if(this.NavigationController != null) | ||
// this.NavigationController.Title = this.TabBarItem.Title; | ||
|
||
// Create text attributes for navigation bar button | ||
UITextAttributes attr = new UITextAttributes(); | ||
attr.Font = UIFont.FromName("OstrichSans-Black", 16); | ||
attr.TextColor = UIColor.White; | ||
attr.TextShadowColor = UIColor.DarkGray; | ||
attr.TextShadowOffset = new UIOffset(0, 0); | ||
|
||
// Set back button for navigation bar | ||
btnBack = new UIBarButtonItem(title, UIBarButtonItemStyle.Plain, null, null); | ||
btnBack.SetTitleTextAttributes(attr, UIControlState.Normal); | ||
this.NavigationItem.BackBarButtonItem = btnBack; | ||
|
||
// Load data source | ||
tableViewSource = new ListTableViewSource(Items, actionOnItemSelected); | ||
tableView.Source = tableViewSource; | ||
} | ||
|
||
public override void ViewDidUnload() | ||
{ | ||
base.ViewDidUnload(); | ||
|
||
// Clear any references to subviews of the main view in order to | ||
// allow the Garbage Collector to collect them sooner. | ||
// | ||
// e.g. myOutlet.Dispose (); myOutlet = null; | ||
|
||
ReleaseDesignerOutlets(); | ||
} | ||
|
||
public override void ViewWillAppear(bool animated) | ||
{ | ||
base.ViewWillAppear(animated); | ||
|
||
MPfmNavigationController navCtrl = (MPfmNavigationController)this.NavigationController; | ||
navCtrl.SetTitle(title); | ||
} | ||
|
||
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation) | ||
{ | ||
// Return true for supported orientations | ||
if (UserInterfaceIdiomIsPhone) | ||
{ | ||
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown); | ||
} else | ||
{ | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
MPfm/branches/current/MPfm.iOS/Classes/Controllers/ListViewController.designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.