HMSegmentedControlを使用して、セグメント化された制御を実現します



Use Hmsegmentedcontrol Realize Segmented Control



郝萌は彼の貢献に専念し、著者の努力の結果を尊重します。転載しないでください。



記事が役に立ったら、著者に寄付して、郝萌をサポートしてください。寄付の金額は恣意的であり、焦点はあなたの心にあります

寄付したい: クリックして寄付する



Cocos2d-X×××: 送信するには私をクリックしてください


HMSegmentedControlはUISegmentedControlの代わりであり、GoogleCurrentsで使用される効果を模倣しています。



以下のコードは、デフォルトの外観でセグメント化されたコントロールを作成します。

HMSegmentedControl *segmented = [[HMSegmentedControl alloc] initWithSectionTitles:@[@'Announcement received',@'Announcement issued']] segmented.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth segmented.frame = CGRectMake(self.view.bounds.bounds. .width/2-100, 4, 200, 40) segmented.backgroundColor = [UIColor clearColor] segmented.selectionIndicatorHeight = 3.0f segmented.font = [UIFont fontWithName:@'STHeitiSC-Light' size:19.0f] segmented.textColor = WHRGB(255, 175, 185) segmented.selectedTextColor = [UIColor whiteColor] segmented.selectionIndicatorColor = [UIColor whiteColor] segmented.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe segmented.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocation: add @selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged] self.segmentedControl = segmented [self.navigationController.na vigationBar addSubview:segmented]
コントロールを完全にカスタマイズする方法を示すデモプロジェクトが含まれています。



郝萌は彼の貢献に専念し、著者の努力の結果を尊重します。転載しないでください。

記事が役に立ったら、著者に寄付して、郝萌をサポートしてください。寄付の金額は恣意的であり、焦点はあなたの心にあります

寄付したい: クリックして寄付する

Cocos2d-X×××: 送信するには私をクリックしてください

転載:https://blog.51cto.com/haomengzhu/1664344