Xamarin_iOS Hello world 遇到的第一个问题
来源:互联网 发布:畅游无限浏览器 mac 编辑:程序博客网 时间:2024/04/27 15:45
NSInvalidArgumentException error in button click - xamarin
TranslateBtn.TouchUpInside += (object sender, EventArgs e) =>
{
// Convert the phone number with text to a number
// using PhoneTranslator.cs
translatedNumber = PhoneTranslator.translateToNumber(
PhoneNumberText.Text);
// Dismiss the keyboard if text field was tapped
PhoneNumberText.ResignFirstResponder();
if (translatedNumber == "")
{
callBtn.SetTitle("Call ", UIControlState.Normal);
callBtn.Enabled = false;
}
else {
callBtn.SetTitle("Call " + translatedNumber,
UIControlState.Normal);
callBtn.Enabled = true;
}
};
{
// Convert the phone number with text to a number
// using PhoneTranslator.cs
translatedNumber = PhoneTranslator.translateToNumber(
PhoneNumberText.Text);
// Dismiss the keyboard if text field was tapped
PhoneNumberText.ResignFirstResponder();
if (translatedNumber == "")
{
callBtn.SetTitle("Call ", UIControlState.Normal);
callBtn.Enabled = false;
}
else {
callBtn.SetTitle("Call " + translatedNumber,
UIControlState.Normal);
callBtn.Enabled = true;
}
};
点击这个按钮,出现上面那个错误。
一再查看代码,完全跟例程一致,为什么还是抛这个错误呢?
原因在于 新创建一个项目时,在main.storyboard 添加一个按钮时,在events 栏目下的touch-->up inside 默认绑定了一个事件监听handler,去除即可。
0 0
- Xamarin_iOS Hello world 遇到的第一个问题
- TG2 第一个尝试:hello world 遇到的问题
- 刚刚接触java,第一个hello world 所遇到的问题
- 我的第一个Linux驱动hello world问题记录
- python第一个hello world注意问题!!
- silverlight的第一个程序hello world.
- java的第一个程序 ----Hello World
- GO语言的--第一个Hello World
- Android的第一个hello world
- Nginx的第一个模块-Hello World
- C++的第一个程序:Hello World
- 第一个clojure 的hello world程序
- Hello World -- 我的第一个程序
- nodejs的第一个程序Hello World
- Springboot的第一个Hello World程序
- Springboot的第一个Hello World程序
- Python 的第一个 hello world 程序!
- 我的第一个Java“Hello World!”
- 谈谈基于OAuth 2.0的第三方认证 [上篇]
- 我的系统设计之道
- 亲测可行 php tools for vs2013 破解 + 配置调试
- python基础教程-数字与表达式——浮点数
- 记一次使用 git bisect 快速定位 bug 的过程
- Xamarin_iOS Hello world 遇到的第一个问题
- Android中URI的转换关于file和content相互转换工具类
- 链接: https://pan.baidu.com/s/1jILU9YA 密码: xg3e
- windows创建以‘.’开头的文件提示必须键入名称的解决办法
- 动态规划--100层楼2只鸡蛋最少次可以测试最高楼层不摔破
- "=="和equals的区别
- android 开发 TabLayout+ViewPager 点击+滑动效果
- Python读取文件夹下的所有文件
- 菜鸟初学readis随笔,用作记录