Ios8 如何将振动效果添加到UISegmentedControl而不是其标签?
在通知中心,顶部分段控件看起来具有振动效果。然而,它的标签(今天和通知)似乎是规则的、不透明的颜色。我如何复制此功能?首先,将UISegmentedControl添加到具有活力的UIVisualEffectView 然后,将另一个相同的UISegmentedControl添加到上一个分段控件的正上方,但不在同一视图中,即上方或任何位置的视图中 将upperSegmentedControl的TintColor设置为Ios8 如何将振动效果添加到UISegmentedControl而不是其标签?,ios8,uivibrancyeffect,Ios8,Uivibrancyeffect,在通知中心,顶部分段控件看起来具有振动效果。然而,它的标签(今天和通知)似乎是规则的、不透明的颜色。我如何复制此功能?首先,将UISegmentedControl添加到具有活力的UIVisualEffectView 然后,将另一个相同的UISegmentedControl添加到上一个分段控件的正上方,但不在同一视图中,即上方或任何位置的视图中 将upperSegmentedControl的TintColor设置为UIColor.clearcolor() 将UserInteractionEnabl
UIColor.clearcolor()
将UserInteractionEnabled设置为false
然后呢,
upperSegmentedControl.setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.whiteColor()], forState: UIControlState.Normal)
upperSegmentedControl.setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.clearColor()], forState: UIControlState.Selected)
重要提示:保持两段同步。
这不是最聪明的解决方案,但它确实有效