UISegementControl切换简单应用
来源:互联网 发布:黑白棋估值函数优化 编辑:程序博客网 时间:2024/06/08 19:33
// segement
//
// Created by Catherine on 2017/8/29.
// Copyright © 2017年 Catherine. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
let viewBlue:UIView =UIView(frame: CGRect(x:0, y: 0, width:320, height: 568))
let viewRed:UIView =UIView(frame: CGRect(x:0, y: 0, width:320, height: 568))
overridefunc viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let seg:UISegmentedControl =UISegmentedControl(items: ["blue","red"])
seg.addTarget(self, action:#selector(change(seg:)), for:UIControlEvents.valueChanged)
viewBlue.backgroundColor =UIColor.blue
viewRed.backgroundColor =UIColor.red
//在导航栏标题栏添加分页控制器
self.navigationItem.titleView = seg
//
self.view.addSubview(viewBlue)
self.view.addSubview(viewRed)
//设置默认的那个一个view
self.view.bringSubview(toFront:viewBlue)
}
func change(seg:UISegmentedControl){
if seg.selectedSegmentIndex ==0{
self.view.bringSubview(toFront:viewBlue)
}else{
self.view.bringSubview(toFront:viewRed)
}
}
overridefunc didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
- UISegementControl切换简单应用
- UISegementControl
- 编写简单的视图切换应用
- FragmentTabHost实现底部切换简单应用
- Android 循环切换图片 ConvenientBanner简单应用
- Android 循环切换图片 ConvenientBanner简单应用
- 应用内多语言切换【真@简单】
- javascript的应用,简单设计切换网页主题的应用
- android应用开发之Activity的简单布局切换
- 编写最简单的 iPhone 界面切换应用
- TabStrip 的初学应用(简单页面切换)
- ActionBar简单使用介绍和Tab切换的应用
- UISegementControl设置image不显示
- 简单Dream-ORACLE_RAC故障透明切换测试,已连接的应用不会自动切换到第二个节点上
- 从零开始学习H5应用(1)——V1.0版,简单页面滑动切换效果
- android studio开发Activity切换动画以及ButterKnife注解简单应用
- 从零开始学习H5应用(1)——V1.0版,简单页面滑动切换效果
- Android 应用主题切换
- 浅谈python中的字符编码与转码
- Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)
- 极差归一化
- FFMpeg 源码分析 (3)avformat_open_input()
- 【学习笔记】jQuery库扩展
- UISegementControl切换简单应用
- json转list(谷歌的Gson.jar:)
- 对抗神经网络之对抗卷积神经网络[2]
- 设计模式之--单例模式
- C++自定义命名空间编写
- java框架Spring学习--Spring开发流程
- redis三种客户端:自带客户端、图形界面客户端、Java客户端
- Apache的性能解读
- Redis超级新手指南-上篇(福禄篇)