• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

SwiftUINavigationController

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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, width: 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, width: 200, height: 200);
        tap.view?.frame = frame!;
        
        
    }

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Swift中的Range和NSRange不同发布时间:2022-07-13
下一篇:
Swift对象内存模型探究(一)发布时间:2022-07-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap