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. C#复习总结4

    第十三章 委托 什么是委托 委托就是函数的指针. 其和类相似,其实就是用户自定义的引用类型. 委托是包含有序方法列表的对象,这些方法具有相同的签名和返回类型. MyDel delvar = new M ...

  2. 【转载】C#之C#、.NET Framework、CLR的关系

    C#..NET Framework.CLR的关系 很多人没有将C#..NET Framework(.NET框架).CLR(Common Language Runtime,公共语言运行库)这三者之间的关 ...

  3. HDU 2955 Robberies(01背包变形)

    Robberies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  4. hive impala C++ Java垃圾回收 Garbage Collection GC

    hive impala impala  推荐每个节点内存  2^7~2^8GB Impala与Hive的比较 - 文章 - 伯乐在线 http://blog.jobbole.com/43233/ &l ...

  5. Delphi之萝莉调教篇

    本文纯属技术交流.如果各位看官想与小生一起探讨萝莉的问题的话...PM我吧 关于Delphi的萝莉调教技术,很久以前就有大牛做过了...其实技术早掌握了只是觉得太无聊~估计大家也都会于是就没有写~既然 ...

  6. ABAP debug遇到问题

    新项目的系统,调试是老出现这个框不断弹出,一堆出来 都来不及关. 不确定是不是因为可用对话框不够的原因.

  7. redis12-----redis 与关系型数据库的对比

    书和书签系统 create table book ( bookid int, title ) )engine myisam charset utf8; insert into book values ...

  8. POJ3579 Median —— 二分

    题目链接:http://poj.org/problem?id=3579 Median Time Limit: 1000MS   Memory Limit: 65536K Total Submissio ...

  9. js截取小数点后面2位

    1.substr var str = "Hello world!"; document.write(str.substr(3)); 输出:lo world! var str = & ...

  10. hdu acm 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2191 题目意思:有 资金 n 和 m 种类型的大米,对第 i 种类型的大米,价格.数量.袋数分别是: ...