我试图在我的应用程序中的每个按钮单击时发出咔嗒声为此我创建了一个实用工具类,其.h和.m如下
.h文件
@interface SoundPlayUtil : NSObject<AVAudioPlayerDelegate,AVAudioSessionDelegate>
{
AVAudioPlayer *audioplayer;
}
@property (retain, nonatomic) AVAudioPlayer *audioplayer;
-(id)initWithDefaultClickSoundName;
-(void)playIfSoundisEnabled;
@end
Run Code Online (Sandbox Code Playgroud)
.m文件
@implementation SoundPlayUtil
@synthesize audioplayer;
-(id)initWithDefaultClickSoundName
{
self = [super init];
if (self)
{
NSString* BS_path_blue=[[NSBundle mainBundle]pathForResource:@"click" ofType:@"mp3"];
self.audioplayer =[[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:BS_path_blue] error:NULL];
[self.audioplayer prepareToPlay];
}
return self;
}
-(void)playIfSoundisEnabled
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:soundStatus]==YES)
{
[self.audioplayer play];
}
}
-(void)dealloc
{
[audioplayer release];
[super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)
然后按钮点击我正在做的任何课程
SoundPlayUtil *obj = [[SoundPlayUtil alloc] initWithDefaultClickSoundName];
[obj playIfSoundisEnabled];
[obj release];
Run Code Online (Sandbox Code Playgroud)
它工作正常,我成功播放声音.当我分析代码时出现问题.编译器显示实用程序类的.m 中的initWithDefaultClickSoundName …
我从https://github.com/yourabi/PathMenuExample/downloads下载了Menu Path 2.0 ."添加"按钮可以扩展和折叠一系列菜单项(沿曲线绘制的动画菜单).

但我想让这些按钮直线扩展/折叠.
这是代码 ExpandableNavigation.m:
- (void) expand {
transition = YES;
[UIView animateWithDuration:self.speed animations:^{
self.mainButton.transform = CGAffineTransformMakeRotation( 45.0 * M_PI/180 );
}];
for (UIView* view in self.menuItems) {
int index = [self.menuItems indexOfObject:view];
CGFloat oneOverCount = self.menuItems.count + 50<=1?1.0:(1.0/(self.menuItems.count-1));
CGFloat indexOverCount = index *oneOverCount;
CGFloat rad =(1.0 - indexOverCount) * 90.0 * M_PI/180;
CGAffineTransform rotation = CGAffineTransformMakeRotation( rad ) ;
CGFloat x = (self.radius + self.bounce * self.radius ) * rotation.a;
CGFloat y = (self.radius …Run Code Online (Sandbox Code Playgroud) 在界面构建器中,"可访问性"下的UIButton属性显示为"播放声音".
任何人都可以解释这是什么.实际上我正在制作一个应用程序,它在每次按钮点击播放声音,我可以禁用设置屏幕的声音.UIButton的这个属性能帮助我吗?
谢谢
嗨,大家好我遇到了问题预期的标识符或(以下是.h文件中的代码
#import <Foundation/Foundation.h>
#import "HelloWordPlugin.h"
extern "C" //Error Expected identifier or (
{
void _displayUIAlertViewWithTitleAndMessage(const char* title, const char* message);
}
NSString* CreateNSString(const char* string);
char* MakeStringCopy(const char* string);
Run Code Online (Sandbox Code Playgroud)
我在.mm文件中添加了他们的定义,我无法找到实际问题,请指教
我从某个地方了解到,如果我将我的苹果设备更新到iOS 7,它将无法将其与Xcode 4.6连接以进行调试.但我可以使用运行iOS 7和Xcode 4.6的iPod 5,用它来调试我的代码.大多数时候Xcode不与设备连接,但有时它会.请告知它可能是什么类型的问题?