技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

swift版本hello

复制代码
import UIKit

class ViewController: UIViewController {
    
    @IBOutlet var button : UIButton?
    //var alertView:UIAlertView?

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func buttonPressed(sender : AnyObject) {
        NSLog(button!.titleLabel!.text!)
        var alertView : UIAlertView = UIAlertView(title: "Are You Sure", message: "Look This", delegate: nil, cancelButtonTitle: "OK")
        alertView.show()
    }
}
复制代码

连接有两处:

1. 设计视图和代码声明的按钮定义的连接

2. 设计视图的按钮点击事件和代码的函数之间的连接

用辅助视图同时打开代码文件和视图,按住control拖拽按钮到代码,可以分别建立相应的连接

posted on   codestyle  阅读(240)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· SQL Server 2025 AI相关能力初探
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示