Cannot call value of non-function type 'UITextView'报错
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 = ""
}
}
最新文章
- PBOC~PPT-补充A(转)
- 主机名链接数据库,无法生成 SSPI 上下文
- Android Studio开发JNI工程
- CodeForces 433C Ryouko's Memory Note-暴力
- jasonTree多选多级树控件
- 试图使用未在此报表服务器中注册或此版 Reporting Services 不支持的数据扩展插件“Devart.Data.PostgreSql”
- eclipse3.7 安装maven插件与scm
- JavaScript 字符串函数 之查找字符方法(一)
- 开源API测试工具 Hitchhiker v0.5更新 - 完善细节
- 访问PHP文件时出现An error occurred.
- (转)dubbo远程调用细节
- solt插槽简单使用实例
- 自学Zabbix11.3 Zabbix SNMP 常用OID列表
- 自适应尺寸变化的meanshift跟踪
- 前端项目打包工具weexpack的安装
- Linux笔记:vi常用命令
- luogu NOIp热身赛(2018-11-07)题解
- “全栈2019”Java异常第十一章:重写方法时只能抛出父类异常子集
- MFC窗体程序中添加调试控制台
- AngularJs学习笔记--unit-testing
热门文章
- BUPT复试专题—最小距离查询(2013)
- 关于结构体的具体解说,C、C++中的差别
- MySQL远程访问时非常慢的解决方案
- IBM中国研究院、SAP、网易游戏、IBM2015应届生招聘笔试面试问题分享
- notepad++的f90配置文件
- LeetCode题解(20)--Valid Parentheses
- 2016/05/27 php上传文件常见问题总结
- Linux下编译安装源码包软件 configure ,make, make install, make test/check, make clean
- rails使用mysql数据库
- HDU 2746 Cyclic Nacklace