iOS里面的开发,类写到一半就报错这个。后来发现是因为重名的时候召唤对象不明确的问题。先贴代码,晚点再说

出错点

//ヒントをクリアするためのイニシャライザ

init (clearStr: UITextView, clearSco: UITextView) {

nowCombi = "" //ダミー

clearStr(strTextView: clearStr, scoTextView: clearSco)

}

修改后

//化合物のヒントの文字列を作るクラス

class CombiHint {

private let nowCombi: String

private var hintString: String = ""

private var hintScore: String = ""

private let systemFontAs20: UIFont = UIFont.systemFont(ofSize: 20)

//-----------------イニシャライザ-------------------

//何もしない簡単なイニシャライザ

init(nowCombi temp: String) {

nowCombi = temp

}

//ヒントを作る処理をするイニシャライザ originStrToBeProcessed

convenience init(oriToBePro temp: String) {

self.init(nowCombi: temp)

hintPro()

}

//ヒントを作ってテキストビューに設定するイニシャライザ

convenience init(oriToBePro temp: String, stringTextView: UITextView, scoreTextView: UITextView) {

self.init(nowCombi: temp)

hintPro()

stringTextView.text = hintString

scoreTextView.text = hintScore

stringTextView.font = getFontSizeAsDefault()

scoreTextView.font = getFontSizeAsDefault()

}

//ヒントをクリアするためのイニシャライザ

init (clearStr: UITextView, clearSco: UITextView) {

nowCombi = "" //ダミー

self.clearStr(strTextView: clearStr, scoTextView: clearSco)

}

//---------------------関数-----------------------

//関数1.1

//ヒントの文字列を作る

private func hintPro() {

for combi in cardComRef {

if nowCombi == "C" {

if combi.ref == .Cl2 || combi.ref == .CuO || combi.ref == .CuS || combi.ref == .CuCl2 {

continue

}

}

if combi.ref.rawValue.hasPrefix(nowCombi) {

let stringConv = StringAdapter(origin: combi.ref.rawValue, ouType: .under)

//hintString += combi.ref.rawValue + "\n"

hintString += stringConv.getResult() + "\n"

hintScore += String(Int(combi.card.rawValue)) + "\n"

}

}

}

//関数2.1

//文字サイズが20のフォントを取得

func getFontSizeAsDefault() -> UIFont {

return systemFontAs20

}

//関数2.2

//自分の好きな文字サイズを設定

func getFontSize(howMuch: Double) -> UIFont {

return UIFont.systemFont(ofSize: CGFloat(howMuch))

}

//関数3.1

//hintStringを取得

func getHintString() -> String {

return hintString

}

//関数3.2

//hintScoreを取得

func getHintScore() -> String {

return hintScore

}

//関数3.3

//hintStringとhintScoreを一括に取得

func getHStringAndHScore() -> (hintString: String, hintScore: String) {

return (hintString: getHintString(), hintScore: getHintScore())

}

//関数4.1

//テキストビューの文字列をクリアする

private func clearStr(strTextView: UITextView, scoTextView: UITextView) {

strTextView.text = ""

scoTextView.text = ""

}

}

Cannot call value of non-function type 'UITextView'报错的更多相关文章

  1. JS function document.onclick(){}报错Syntax error on token "function", delete this token

    JS function document.onclick(){}报错Syntax error on token "function", delete this token func ...

  2. "XX cannot be resolved to a type "eclipse报错及解决说明

    转自:http://zhaoningbo.iteye.com/blog/1137215 引言: eclipse新导入的项目经常可以看到“XX cannot be resolved to a type” ...

  3. "XX cannot be resolved to a type "eclipse报错及解决

    好久都没有写博了,还记得自己准备考研,结果你会发现——你永远不知道,你将会走上哪个路. 长远的目标是好的,但有些时候身不由己也迫不得已!做好自己的当下就是好的. 不论搞什么,总会遇到各种各样的问题,以 ...

  4. mysql5.5碰到的type= MyISAM报错问题

    最近把mysql升级到5.5版本,发现type= MyISAM报错,网上查了一下原来MYSQL5.5.x 版本 不支持 TYPE=MyISAM  这样的语句了!!! MYSQL语句写法 TYPE=My ...

  5. JS function document.onclick(){}报错Syntax error on token "function", delete this token - CSDN博客

    原文:JS function document.onclick(){}报错Syntax error on token "function", delete this token - ...

  6. std::unique_ptr使用incomplete type的报错分析和解决

    Pimpl(Pointer to implementation)很多同学都不陌生,但是从原始指针升级到C++11的独占指针std::unique_ptr时,会遇到一个incomplete type的报 ...

  7. TypeError: value.getTime is not a function (elementUI报错转载 )

    "TypeError: value.getTime is not a function" 2018年07月02日 16:41:24 leeleejoker 阅读数:2091 标签: ...

  8. ie8下修改input的type属性报错

    摘要: 现在有一个需求如图所示,当用户勾选显示明文复选框时,要以明文显示用户输入的密码,去掉勾选时要变回密文,刚开始想到的就是修改输入框的type来决定显示明文还是密文,使用jQuery的attr来做 ...

  9. Mac下Android绘制点9格式png以及解决IllegalArgumentException: Unknown image type 0报错

    在Mac下的AndroidStudio中,右键png图片选择“create 9-patch-file”时会报错:IllegalArgumentException: Unknown image type ...

随机推荐

  1. GBDT调参

    gbm算法流程图: gbdt 参数:参考scikit-learn The overall parameters can be divided into 3 categories: Tree-Speci ...

  2. 【转】利用shell命令操作Memcached

    原文: 张宴的博客 —— http://zyan.cc/post/384/ -------------------------------------------------------------- ...

  3. Flex事件机制学习-自定义事件实现类间通信 .

    今天,学习Flex自定义事件,可以使两个类通信,定义一个Main类. public class Main extends Sprite     {            public function ...

  4. Mac 下配置 Cocos2d-x 3-x android 的环境

    本人初学Cocos2d 3-x,环境配置,搭建android环境弄了好长时间,走了不少弯路,翻阅了好多人的博客和文档,包括官方文档讲的似乎有些似懂非懂,好多依然是旧的版本,所以把我的整个过程梳理一下. ...

  5. java之集合Collection 具体解释之4

    package cn.itcast_04; public class Student { private String name; private int age; public Student() ...

  6. A new session could not be created. (Original error: Requested a new session but one was in progress) )错误解决办法

    z在desiredCapabilities里新增这俩居然fix了问题,原因暂时不得而知: capabilities.setCapability("unicodeKeyboard", ...

  7. 基于ADB框架Robotium跨进程操作

    转自:http://blog.csdn.net/qingchunjun/article/details/42580937 2015年2月3日更新: 有些朋友在用真机尝试本方法时,抛出了InputStr ...

  8. 在vc6.0下编的对话框界面如果没做过其他处理,往往显的很生硬,怎么样才能使他有Windows XP的风格呢,其实也很简单,我们来看看下面两种方法。

    在vc6.0下编的对话框界面如果没做过其他处理,往往显的很生硬,怎么样才能使他有Windows XP的风格呢,其实也很简单,我们来看看下面两种方法.    方法一: 1.首先确认你在Windows   ...

  9. python -- day 11 考试题

    1. 文件t1.txt里面的内容为:(6分) 1,alex,22,13651054608,IT 2,wusir,23,13304320533,Tearcher 3,taibai,18,13332353 ...

  10. 使用Mock.js进行独立于后端的前端开发

    Mockjs能做什么? 基于 数据模板 生成模拟数据. 基于 HTML模板 生成模拟数据. 拦截并模拟 ajax 请求. 能解决的问题 开发时,前后端进度不同步,后端还没完成数据输出,前端只好写静态模 ...