swift创建button、label、imgview、以及添加手势与动画
2017-06-21 16:53
1116 查看
试试用swift创建UI、可以看看,swift还是简单,慢慢学习
import UIKit
let a = 1
let label = UILabel()
class ViewController: UIViewController {
let b =
2
override
func viewDidLoad() {
super.viewDidLoad()
//1、创建一个view
let bgView =
UIView(frame:CGRect(x:0,y:0,width:375,height:667))
bgView.backgroundColor =
UIColor.red;
//bgView.isHidden = true
self.view.addSubview(bgView)
//2、创建button
/*
UIButtonType.system:前面不带图标,默认文字颜色为蓝色,有触摸时的高亮效果
UIButtonType.custom:定制按钮,前面不带图标,默认文字颜色为白色,无触摸时的高亮效果
UIButtonType.contactAdd:前面带“+”图标按钮,默认文字颜色为蓝色,有触摸时的高亮效果
UIButtonType.detailDisclosure:前面带“!”图标按钮,默认文字颜色为蓝色,有触摸时的高亮效果
UIButtonType.infoDark:为感叹号“!”圆形按钮
UIButtonType.infoLight:为感叹号“!”圆形按钮
*/
let
import UIKit
let a = 1
let label = UILabel()
class ViewController: UIViewController {
let b =
2
override
func viewDidLoad() {
super.viewDidLoad()
//1、创建一个view
let bgView =
UIView(frame:CGRect(x:0,y:0,width:375,height:667))
bgView.backgroundColor =
UIColor.red;
//bgView.isHidden = true
self.view.addSubview(bgView)
//2、创建button
/*
UIButtonType.system:前面不带图标,默认文字颜色为蓝色,有触摸时的高亮效果
UIButtonType.custom:定制按钮,前面不带图标,默认文字颜色为白色,无触摸时的高亮效果
UIButtonType.contactAdd:前面带“+”图标按钮,默认文字颜色为蓝色,有触摸时的高亮效果
UIButtonType.detailDisclosure:前面带“!”图标按钮,默认文字颜色为蓝色,有触摸时的高亮效果
UIButtonType.infoDark:为感叹号“!”圆形按钮
UIButtonType.infoLight:为感叹号“!”圆形按钮
*/
let
相关文章推荐
- view上添加点手势 button无法响应点击事件
- swift 代码创建UITableView以及部分swift的讲解
- ViewFlipper(多图层控件)及手势识别,代码创建动画效果
- view上添加点手势 button无法响应点击事件
- 代码创建button、view、label等控件
- RecyclerView 添加动画,以及快速滑动导致的问题
- IOS 纯代码添加 Button Image Label 添加到自定义View中
- Swift - 动态添加删除TableView的单元格(以及内部元件)
- 在xib 4000 中给view添加手势(swift)
- Swift-->ViewController跳转,转场以及自定义动画
- 20.ViewFilpper+手势实现ViewPager功能+添加动画
- RecyclerView 动画 (添加、删除动画 以及 加载item 时的动画)
- RecycleView添加分割线(ItemDecoration)以及交互动画效果
- view上添加点手势 button无法响应点击事件
- iOS开发,UISlider滑块不灵敏问题以及在UIScrollView上添加Slider造成手势冲突问题心得
- 关于在自定义View中添加Button按钮以及实现点击事件
- [iOS]swift之UITableView添加通过xib创建的headerView坑爹问题
- IOS中Label,imageView,view,button怎么添加边框?
- 在UITableView或UICollectionView的自定义的cell里添加手势或button,响应方法时如何传参数
- swift项目第八天:自定义转场动画以及设置titleView的状态