zoukankan      html  css  js  c++  java
  • Swift UINavigationController

    import UIKit
    import CoreData


    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {

        var window: UIWindow?


        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            
            
            self.window = UIWindow(frame:UIScreen.main.bounds);
            self.window?.backgroundColor = UIColor.red;
            let navagationVC = UINavigationController.init(rootViewController: ViewController());
            self.window?.rootViewController = navagationVC;
            self.window?.makeKeyAndVisible();
            
           
            return true
        }

    import UIKit

    class ViewController: UIViewController {

        override func viewDidLoad() {
            super.viewDidLoad()
            self.title = "我的主页";
            self.navigationController?.navigationBar.barTintColor = UIColor.blue;
            
            let image = UIImage.init(named: "111.png");
            let imageView = UIImageView();
            imageView.frame = CGRect.init(x: 100, y: 100, 200, height: 200);
            imageView.image = image;
            self.view.addSubview(imageView);
            //圆角
            imageView.layer.masksToBounds = true;
            imageView.layer.cornerRadius = 100;
            imageView.layer.borderColor = UIColor.orange.cgColor;
            imageView.layer.borderWidth = 2
            imageView.clipsToBounds = true;
            //交互
            imageView.isUserInteractionEnabled = true;
            let tap = UITapGestureRecognizer.init(target: self, action:#selector(ViewController.tapAction));
            imageView.addGestureRecognizer(tap);
            //设置拉伸模式
            imageView.contentMode = UIViewContentMode.scaleAspectFill;
        
            
        }
        func tapAction(tap:UITapGestureRecognizer) {

            var frame = tap.view?.frame;
            
            frame = CGRect.init(x: 100, y: 200, 200, height: 200);
            tap.view?.frame = frame!;
            
            
        }

    }
    详细代码查看:https://github.com/xiaolitou-ping/Swift-All

  • 相关阅读:
    DAY 57 django12
    韦东山网课https://edu.csdn.net/course/play/207/1117
    关于初始化
    软件——机器学习与Python,Python3的输出与输入
    关于python中数组的问题,序列格式转换
    偏最小二乘法
    数据标准化
    SD卡与tf卡引脚转换
    程序心得
    牛客网 python 求解立方根
  • 原文地址:https://www.cnblogs.com/laolitou-ping/p/7697657.html
Copyright © 2011-2022 走看看