|
@@ -130,8 +130,8 @@ public class ComponentCPosition: ComponentBaseXibView {
|
|
let rows = properties.rowCount
|
|
let rows = properties.rowCount
|
|
let columns = properties.columnCount
|
|
let columns = properties.columnCount
|
|
|
|
|
|
- itemHeight = (bounds.size.height-CGFloat(rows)+1)/CGFloat(rows)
|
|
|
|
- itemWidth = (bounds.size.width-CGFloat(columns)+1)/CGFloat(columns)
|
|
|
|
|
|
+ itemHeight = (bounds.size.height-CGFloat(rows)-1)/CGFloat(rows)
|
|
|
|
+ itemWidth = (bounds.size.width-CGFloat(columns)-1)/CGFloat(columns)
|
|
|
|
|
|
if let subviews = contendBox.contentView?.subviews {
|
|
if let subviews = contendBox.contentView?.subviews {
|
|
for view in subviews {
|
|
for view in subviews {
|
|
@@ -141,11 +141,10 @@ public class ComponentCPosition: ComponentBaseXibView {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ var yValue: CGFloat = 1
|
|
for row in 0...properties.rowCount-1 {
|
|
for row in 0...properties.rowCount-1 {
|
|
var xValue: CGFloat = 1
|
|
var xValue: CGFloat = 1
|
|
for column in 0...properties.columnCount-1 {
|
|
for column in 0...properties.columnCount-1 {
|
|
- var yValue: CGFloat = 1
|
|
|
|
-
|
|
|
|
let item = ComponentCPositionItem()
|
|
let item = ComponentCPositionItem()
|
|
item.frame = CGRectMake(xValue + CGFloat(column)*itemWidth, CGFloat(row)*itemHeight + yValue, itemWidth, itemHeight)
|
|
item.frame = CGRectMake(xValue + CGFloat(column)*itemWidth, CGFloat(row)*itemHeight + yValue, itemWidth, itemHeight)
|
|
item.row = row
|
|
item.row = row
|
|
@@ -155,12 +154,11 @@ public class ComponentCPosition: ComponentBaseXibView {
|
|
item.isDisabled = properties.isDisabled
|
|
item.isDisabled = properties.isDisabled
|
|
item.delegate = self
|
|
item.delegate = self
|
|
item.autoresizingMask = [.maxXMargin, .maxYMargin]
|
|
item.autoresizingMask = [.maxXMargin, .maxYMargin]
|
|
-
|
|
|
|
contendBox.contentView?.addSubview(item)
|
|
contendBox.contentView?.addSubview(item)
|
|
|
|
|
|
xValue += 1
|
|
xValue += 1
|
|
- yValue += 1
|
|
|
|
}
|
|
}
|
|
|
|
+ yValue += 1
|
|
}
|
|
}
|
|
|
|
|
|
display()
|
|
display()
|
|
@@ -242,6 +240,8 @@ extension ComponentCPosition: ComponentCPositionItemDelegate {
|
|
let item = subview as! ComponentCPositionItem
|
|
let item = subview as! ComponentCPositionItem
|
|
if item != view {
|
|
if item != view {
|
|
item.state = .normal
|
|
item.state = .normal
|
|
|
|
+ item.refresh()
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|