watchOS

WatchOS系统开发大全(8)-WKInterfaceGrou

2017-07-27  本文已影响102人  坤小

1.1-简介

1.1.1 WatchApp的storyboard中控件的布局规则

1.1.2 如果想让一行显示多个控件,应该怎么办?

1.1.3 Group控件的作用

1.1.4 Group控件的特性

1.2-API介绍


    //设置圆角
    public func setCornerRadius(cornerRadius: CGFloat)
    //设置边距偏移量
    @available(watchOS 2.0, *)
    public func setContentInset(contentInset: UIEdgeInsets)
    //设置背景颜色和背景图片
    public func setBackgroundColor(color: UIColor?)
    public func setBackgroundImage(image: UIImage?)
    public func setBackgroundImageData(imageData: NSData?)
    public func setBackgroundImageNamed(imageName: String?)


    //MARK:--WKInterfaceGroup
    //WKInterfaceGroup是WatchOS中唯一一个可以放视图的容器,有点类似UIScrollView,它的子视图也只能选择水平或者竖直布局
    //设置边距偏移量(2.0新增)
    /**
    *ContentSize:表示的是视图的区域,如scorllView的可滚动区域
    *ContentOffSet:表示的是当前显示区域顶点相对于视图顶点的偏移量,如scorllView和UITableViwe的x和y的偏移量
    *ContentInset:表示视图容器的内部视图的边距偏移量
    */
    group.setContentInset(UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5))
        
上一篇 下一篇

猜你喜欢

热点阅读