Sunday, July 25, 2010

Disable Edit Button on "More" tab of UITabBarController using Monotouch

Today I will show you how to disable the Edit button on "More" tab of UITabBarController.
Following screen shot displays a tab bar controller displaying "More" tab with 2 items and an edit button on top right side of navigation bar.

Clicking the button brings up a configure view where all the tabs are displayed and can be moved around as shown below.

Adding the following code in ViewDidLoad() method  of your UITabBarController class removes the items from the "Configure" view. 
/* */
this.CustomizableViewControllers = null;
/* */

Adding the following code in ViewDidLoad() method  of your UITabBarController class disables the "Edit" button.
/* */
this.MoreNavigationController.NavigationBar.TopItem.RightBarButtonItem.Enabled = false;
/* */

Monday, July 19, 2010

Hide iPhone tabbar using Monotouch C#

I will show here how to hide a tab bar for a view which is part of a tab bar controller.
I have a tab bar app which has 3 tabs(News, Account, Map)
Account tab has a table view containing 3 cells(Id Card, Meal Plan, Academics),
Clicking on Id Card cell brings another view which displays an id card.

We will remove tab bar from the bottom of the Id Card view like shown below.   

                                                                   

Lets look at the two classes associated with the parent(Account), child(Id Card) view.

StudentAccountController - This class brings the table view for the account tab and the cells associated with the view.
StudentIdController - This class brings the Id Card view.
In the RowSelected() method of Delegate class of StudentAccountController, the StudentIdController is dynamically loaded.
Here we just need to set HidesBottomBarWhenPushed property of the child view to true.

public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
    if(indexPath.Row == (int)itemIndex.IdCard)
    {
     StudentIdModalView studentIdVC = new StudentIdModalView();
     studentIdVC.HidesBottomBarWhenPushed = true;
     studentController.NavigationController.PushViewController(studentIdVC, true);
    }
 }

Sunday, July 18, 2010

Reviewing Professional iPhone Programming with Monotouch and .NET/C#

Just got the latest book on iPhone programing with Monotouch. Being a .Net/C# developer myself I'm excited to learn and create iPhone apps using C#. I would be adding some sample apps I create with Monotouch here.
In the mean time you can get more information on this new book form Amazon. I have added the information below.