
正如您在屏幕截图中看到的,默认按钮很有活力,看起来更好.
我尝试用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时变得活跃?
我还应该补充说我正在使用Xamarin.iOS.
解决方法 我似乎有解决自己的问题.我最终在里面创建了带有空白UIVIEw的UIVisualEffectVIEw并将其添加到UIbutton后面.此代码段显示了如何设置一个按钮的样式:
// Create effect vIEwvar effectVIEw = new UIVisualEffectVIEw(UIVibrancyEffect.CreateForNotificationCenter ());// This color looks best for me. You can play around with it to make it look bettereffectVIEw.Backgroundcolor = UIcolor.FromrGBA(55,55,100);// position effectVIEweffectVIEw.Frame = mybutton.Frame;// Add effectVIEw and send it to back,behind actual buttonthis.VIEw.AddSubvIEw(effectVIEw);this.VIEw.SendSubvIEwToBack (effectVIEw);// Create UIVIEw and add it to effectVIEw's ContentVIEwvar 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 cornerseffectVIEw.Layer.MasksToBounds = true;effectVIEw.Layer.CornerRadius = 4.0f;
这就是它的样子:
总结以上是内存溢出为你收集整理的ios – 应用UIVibrancyEffect时,UIButton的标题不可见全部内容,希望文章能够帮你解决ios – 应用UIVibrancyEffect时,UIButton的标题不可见所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)