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. springboot mybatis 项目框架源码 shiro 集成代码生成器 ehcache缓存

    1.代码生成器: [正反双向](单表.主表.明细表.树形表,快速开发利器)freemaker模版技术 ,0个代码不用写,生成完整的一个模块,带页面.建表sql脚本.处理类.service等完整模块2. ...

  2. remove_if的问题

    #include<iostream> #include<list> #include<algorithm> #include"PRINT_ELEMENTS ...

  3. 零基础学python-3.2 变量赋值

    这一节我们来具体展开变量赋值 1.以下我们举各种赋值的样例 anInt=12 anFloat=2.2 anStr='string' aList=['a','a','a'] anArray=(1,2,3 ...

  4. 在Nginx上部署ThinkPHP,解决Pathinfo问题

    在Nginx上部署ThinkPHP,解决Pathinfo问题 事实上.要解决nginx不支持pathinfo的问题.有两个解决思路,一是不使用pathinfo模式,二是改动nginx的配置文件,使它支 ...

  5. 锤子Smartisan T1手机官方4.4.2系统内核版本号信息

    从锤子smartisan T1手机官方系统EGL中获取内核版本号信息(由cofface提供): I/Adreno-EGL(  816): <qeglDrvAPI_eglInitialize:41 ...

  6. Type cannot use 'try' with exceptions disabled

    cannot use ‘throw’ with exceptions disabled 在为 DragonBonesCPP/refactoring 的 cocos2d-x-3.2 demo 增加 An ...

  7. apk解包——修改后缀为zip

    将apk修改后缀为zip后,可直接解包查看资源文件

  8. 聊聊高并发(二十四)解析java.util.concurrent各个组件(六) 深入理解AQS(四)

    近期总体过了下AQS的结构.也在网上看了一些讲AQS的文章,大部分的文章都是泛泛而谈.又一次看了下AQS的代码,把一些新的要点拿出来说一说. AQS是一个管程.提供了一个主要的同步器的能力,包括了一个 ...

  9. cocos2d-x触摸事件优先级

     CCTouchDispatcher是管理cocos2d-x中全部Touch事件派发的类, CCTouchDispatcher中包括了两个CCTouchHandler的列表, 分别存储Standa ...

  10. iOS 内购遇到的坑

    一.内购沙盒测试账号在支付成功后,再次购买相同 ID 的物品,会提示如下内容的弹窗.您以购买过此APP内购项目,此项目将免费恢复 原因: 当使用内购购买过商品后没有把这个交易事件关,所以当我们再次去购 ...