标题:
HMSegmentedControl源代码解析(7)
[打印本页]
作者:
look_w
时间:
2019-2-19 17:37
标题:
HMSegmentedControl源代码解析(7)
getter & setter
- (void)setFrame
CGRect)frame {
[super setFrame:frame];
[self updateSegmentsRects];
}
- (void)setSectionTitles
NSArray<NSString *> *)sectionTitles {
_sectionTitles = sectionTitles;
// Allows you to perform layout before the drawing cycle happens. -layoutIfNeeded forces layout early
[self setNeedsLayout];
[self setNeedsDisplay];
}
- (void)setSectionImages
NSArray<UIImage *> *)sectionImages {
_sectionImages = sectionImages;
[self setNeedsLayout];
[self setNeedsDisplay];
}
- (void)setSelectionIndicatorLocation
HMSegmentedControlSelectionIndicatorLocation)selectionIndicatorLocation {
_selectionIndicatorLocation = selectionIndicatorLocation;
if (selectionIndicatorLocation == HMSegmentedControlSelectionIndicatorLocationNone) {
self.selectionIndicatorHeight = 0.0f;
}
}
- (void)setSelectionIndicatorBoxOpacity
CGFloat)selectionIndicatorBoxOpacity {
_selectionIndicatorBoxOpacity = selectionIndicatorBoxOpacity;
self.selectionIndicatorBoxLayer.opacity = _selectionIndicatorBoxOpacity;
}
- (void)setSegmentWidthStyle
HMSegmentedControlSegmentWidthStyle)segmentWidthStyle {
// Force HMSegmentedControlSegmentWidthStyleFixed when type is HMSegmentedControlTypeImages.
if (self.type == HMSegmentedControlTypeImages) {
_segmentWidthStyle = HMSegmentedControlSegmentWidthStyleFixed;
} else {
_segmentWidthStyle = segmentWidthStyle;
}
}
- (void)setBorderType
HMSegmentedControlBorderType)borderType {
_borderType = borderType;
[self setNeedsDisplay];
}
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0