How To Clean Up "Other" Files On iPhone



TODO:

Have you ever noticed a large amount of data in the 'Other' area in iTunes?  It is yellow, and in my case was 3gb+

 

SOLUTION:

To fix, follow the instructions on this link

 I have tried this solution and it worked perfectly!

 

NOTES:

There are no notes on this topic.

How To Change The Font Of MonoTouch.UIKit.UINavigationBar



TODO:

Have you ever wanted to change the Font of your Navigation bar text?

 

SOLUTION:

//Put this public override bool FinishedLaunching of AppDelegate
UITextAttributes titleTextAttributes = new UITextAttributes();
titleTextAttributes.Font = UIFont.FromName("Chalkduster", 20);
rootNavigationController.NavigationBar.SetTitleTextAttributes(titleTextAttributes);

NOTES:

In AppDelegate, put the lines of code above in your FinishedLaunching method.  rootNavigationController is the root nav control you have declared in that class.

How To Show A Custom Annotation On A Map In Monotouch For iPhone



TODO:

Have you ever wanted to show a custom Map Annotation on a Map using Monotouch for iPhone?

 

SOLUTION:

 

public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation)
{
	if(!annotation.GetType().Equals(typeof(MyCustomAnnotation)) )
		return null;
				
	var anv = mapView.DequeueReusableAnnotation("myannotation");
				
	if (anv == null)
	{
		anv = new MKAnnotationView(annotation, "myannotation");
		anv.CanShowCallout = true;
		anv.Image = UIImage.FromFile("Images/myannotation.png");
	}
	else
	{
		anv.Annotation = annotation;
		anv.CanShowCallout = true;
	}
				
	//add a right accessory to show details if there are there and are not the same as the title...
	if(!String.IsNullOrEmpty(  ((MyCustomAnnotation)anv.Annotation).Details) && 
		((MyCustomAnnotation)anv.Annotation).Details != ((MyCustomAnnotation)anv.Annotation).Title )
	{
		var accButton = UIButton.FromType(UIButtonType.DetailDisclosure);
		accButton.Title (UIControlState.Normal);
		anv.RightCalloutAccessoryView = accButton;
	}
				
	return anv;
}

 

 

NOTES:

So here I have created a custom MKAnnoatation class called MyCustomAnnotation.  Basically if the type coming into GetViewForAnnotation() is not mine I am ignoring it.  If it is mine, then I am assigning a custom image to it, and also adding a Right Accessory Button, iff the tite is not the same as the details, and details is not null or empty.  You could show additional images too, if you create another class that inherits MyCustomAnnotations.  For instance  public class MyCustomAnnotation2 : MyCustomAnnotation.  You can then check to see if that is the instance coming in, and assign an image accordingly.  Hope this helps, and feel free to contact me for issues.

How To Show An Alert Dialog Using Monotouch for iPhone



TODO:

Have you ever just wanted to show an alert dialog to the user, for instance if Location Services are not enabled?

 

SOLUTION:

 

using (UIAlertView alert = new UIAlertView ("Oops", "Location Service must be enabled", null, "OK", null))
{
	alert.Show ();
}

 

 

NOTES:

There are no notes on this topic.

How To Fix "Error Synchronizing to XCode" Error In MonoDevelop



TODO:

Have you ever had issues with MonoDevelop not syncing with XCode.  In my scenario I was renaming my namespaces in MonoDevelop, and forgot all about the Class.designercs files.

 

SOLUTION:

When refactoring, be sure that your partial classes have the same namspaces,  Changing it in the View, and failing to do so in the designer.cs file will end up giving you the "Error Synchronizing"  message, and cause changes in Xcode to not sync up.

 

NOTES:

There are I am sure other reason why this may happen, however in my scenario, this was 100% the issue / resolution.