自定义Airplay按钮的外观 [英] Customize the Airplay button's appearance

查看:154
本文介绍了自定义Airplay按钮的外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用标准渐变叠加(在photoshop中完成)使按钮在我的应用中看起来更漂亮。我添加了一个Airplay按钮,但美学不匹配。

I use a standard gradient overlay (done in photoshop) to make buttons look nicer in my app. I added an Airplay button, but the aesthetics are not matching.

我真的想在它上面放一个渐变层使它匹配,但我能找到的任何东西只显示如何用png,不是现有的UIView。如果不是渐变层,我只需要任何方式来改变Apple airplay按钮的外观,同时保持其功能完好无损。

I really want to put a gradient layer over it so it matches, but anything I can find only shows how to do this with a png, not an existing UIView. If not the gradient layer, I just need someway, any way, to change the appearance of the Apple airplay button while keeping its functionality intact.

设置代码很简单:

MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:frame];
[volumeView setShowsVolumeSlider:NO];
[bottomPanel addSubview:volumeView];

如何才能看到它的外观以匹配我的控件?

How can I get the appearance of this to match my controls?

推荐答案

我认为自iOS 6以来有更好的解决方案:
使用

I think there's a better solution to this since iOS 6: Use

- (void)setRouteButtonImage:(UIImage *)image forState:(UIControlState)state;

在MPVolumeView上。

on MPVolumeView.

参见
https://developer.apple.com/Library/ios/documentation/MediaPlayer/Reference/MPVolumeView_Class/index.html#//apple_ref/occ/instm/MPVolumeView/ setRouteButtonImage:forState

这篇关于自定义Airplay按钮的外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆