Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Problem with intro iOS Xamarin tutorial

$
0
0

On step 21 in https://developer.xamarin.com/guides/ios/getting_started/hello,_iOS/hello,iOS_quickstart/ when pasting the provided code into ViewController.cs, Visual Studio for mac says: The name 'PhoneTranslator' does not exist in the current context, about the line containing translatedNumber = PhoneTranslator.ToNumber(PhoneNumberText.Text);. I'm pasting the entire file with the code included:

using System;
using Foundation;

using UIKit;

namespace phoneword_iOS
{
public partial class ViewController : UIViewController
{
protected ViewController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        // Perform any additional setup after loading the view, typically from a nib.


        string translatedNumber = "";

        TranslateButton.TouchUpInside += (object sender, EventArgs e) =>
        {
            // Convert the phone number with text to a number
            // using PhoneTranslator.cs
            translatedNumber = PhoneTranslator.ToNumber(
                PhoneNumberText.Text);

            // Dismiss the keyboard if text field was tapped
            PhoneNumberText.ResignFirstResponder();

            if (translatedNumber == "")
            {
                CallButton.SetTitle("Call ", UIControlState.Normal);
                CallButton.Enabled = false;
            }
            else
            {
                CallButton.SetTitle("Call " + translatedNumber,
                    UIControlState.Normal);
                CallButton.Enabled = true;
            }
        };

    }

    public override void DidReceiveMemoryWarning()
    {
        base.DidReceiveMemoryWarning();
        // Release any cached data, images, etc that aren't in use.
    }
}

}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>