大佬教程收集整理的这篇文章主要介绍了ios – 应用UIVibrancyEffect时,UIButton的标题不可见,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
正如您在屏幕截图中看到的,默认按钮很有活力,看起来更好.
我尝试用UIVisualEffectView替换widget的View,如下所示:
UIVisualEffectView effectView = new UIVisualEffectView(UIVibrancyEffect.CreateForNotificationCenter ()); effectView.Frame = this.View.bounds; effectView.AutoresizingMask = this.View.AutoresizingMask; UIView oldView = this.View; this.View = effectView; effectView.ContentView.AddSubview(oldView); this.View.TintColor = UIColor.Clear;
它似乎工作,但我的按钮的标题也变得充满活力(我希望它们保持黑色):
有没有办法防止按钮标题在应用UIVibrancyEffect时变得活跃?
// Create effect view var effectView = new UIVisualEffectView(UIVibrancyEffect.CreateForNotificationCenter ()); // This color looks best for me. You can play around with it to make it look better effectView.BACkgroundColor = UIColor.FromRGBA(55,55,100); // Position effectView effectView.Frame = myButton.Frame; // Add effectView and send it to BACk,behind actual button this.View.AddSubview(effectView); this.View.SendSubviewToBACk (effectView); // Create UIView and add it to effectView's ContentView var view = new UIView (); view.BACkgroundColor = UIColor.White; effectView.ContentView.AddSubview(view); view.Frame = new CGRect(0,effectView.Frame.Width,effectView.Frame.Height); // Make sure your effect view has rounded corners effectView.Layer.MasksToBounds = true; effectView.Layer.CornerRadius = 4.0f;
这就是它的样子:
以上是大佬教程为你收集整理的ios – 应用UIVibrancyEffect时,UIButton的标题不可见全部内容,希望文章能够帮你解决ios – 应用UIVibrancyEffect时,UIButton的标题不可见所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。