是否有人可以通过教程链接向AVAudioPlayer添加播放进度条?
我在这个网站和谷歌上广泛搜索无济于事
我想知道在代码中使用未使用的函数会产生什么后果?
如果你追捕并删除所有未使用的函数和变量,那么性能会有任何令人难以置信的改善吗?
或者只是删除未使用的函数和变量的好习惯?
使用单词single可能会在标题中使用我的术语.我现在正在寻找一种好的技术.我有一个名为user的实体,用于存储登录数据的用户,例如用于发出服务器请求的会话密钥.我只想要其中一个实体存在.这样做有标准的技术吗?
到目前为止我所拥有的是这样的
NSManagedObjectContext *moc = [self managedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription
entityForName:@"UserEntity" inManagedObjectContext:moc];
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:entityDescription];
NSArray *array = [moc executeFetchRequest:request error:&error];
if (array == nil)
{
// Deal with error...
}
if ([array count]==0) {
//first run of app
}else if([array count]==1)
{
// id like the code to enter here after every app run except for the first one
}else
{
//dont want this to happen
}
Run Code Online (Sandbox Code Playgroud) 我在使用tag属性访问UIButton时遇到了一些麻烦
UIButton *randomButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect ]];
randomButton.frame = CGRectMake(205, 145, 90, 22); // size and position of button
[randomButton setTitle:@"Random" forState:UIControlStateNormal];
randomButton.backgroundColor = [UIColor clearColor];
randomButton.adjustsImageWhenHighlighted = YES;
[randomButton addTarget:self action:@selector(getrandom:)
forControlEvents:UIControlEventTouchUpInside];
randomButton.reversesTitleShadowWhenHighlighted=YES;
randomButton.toggleButton
[self.view addSubview:randomButton];
randomButton.tag=333;
Run Code Online (Sandbox Code Playgroud)
然后在代码中我尝试以下面的方式获取按钮,这给了我一个错误的说法
不兼容的Objective-C类型初始化'struct UIView*',期望'struct UIButton*'
UIButton *random = [self.view viewWithTag:333];
random.highlighted=NO;
Run Code Online (Sandbox Code Playgroud) 我正在使用x-code 3.2.4而我正在使用ios4.1 sdk.
我收到以下错误,当我尝试从音频工具箱称之为"ExtAudioFileOpenURL".
检测试图调用在不存在对iPhone系统库的象征:_Unwind_Resume从功能_ZN15ID3ParserHandleC2EPvPFlS0_mmmPS0_PmE称为图像AudioToolbox.
为什么会发生这种情况,我该如何解决?
谢谢,db.
编辑
另外,当在4.1设备上运行时,我收到此错误"错误:805297555"
我勒个去?
导致问题的确切代码行是这样的.
// Open an audio file and associate it with the extended audio file object.
OSStatus result= ExtAudioFileOpenURL (sourceURLArray[audioFile], &audioFileObject);
Run Code Online (Sandbox Code Playgroud)
它直接来自示例代码项目.该示例代码项目运行正常.
我不明白为什么如果我用相同的代码启动一个新项目我会得到错误.
我只是在从麦克风获取样品进行处理。我为输入和输出设置了音频单元,并且都具有渲染回调。我的问题是关于麦克风回调的回调。
我希望核心音频为我分配麦克风回调中的缓冲区。
UInt32 shouldAllocateBuffer = 1;
AudioUnitSetProperty(audioUnit, kAudioUnitProperty_ShouldAllocateBuffer, kAudioUnitScope_Global, 1, &shouldAllocateBuffer, sizeof(shouldAllocateBuffer));
Run Code Online (Sandbox Code Playgroud)
但是,这样做总是会导致回调中的ioData指针为NULL。我是否在分配自己的缓冲区?
输入项
static OSStatus recordingCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
OSStatus status;
status = AudioUnitRender(audioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames,
ioData); // ioData is null here
}
Run Code Online (Sandbox Code Playgroud)
回放
static OSStatus playbackCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
// ioData is not NULL here but I get silence in the headphones.
return noErr;
}
Run Code Online (Sandbox Code Playgroud) 我在这里看到一些关于使用保留或复制字符串的问题的帖子.我仍然无法理解差异或重要性.
在我的情况下,我有一个类,有一大堆nsstrings来保持字符串.
我希望这个类只被实例化一次,我希望它的nsstring变量根据在表视图中单击的索引进行更改.
我是否正确地说,如果我选择使用保留,每次我在tableview点击上设置它们的值时我的nsstrings会被覆盖,如果我选择副本,我会以某种方式每个字符串有2个实例....?
对不起.....我完全不明白
这可能是一个愚蠢的问题,如果是这样,请提前道歉.我想知道在MXML中是否等同于接口?
每当我觉得需要使用界面时,我总是最终制作动作而不是MXML文件,因为我不知道是否/如何使用.
例如,我将有一个基于vbox的组件.我有4个不同的同一个实现,所以我决定使用一个接口.但是,我没有创建单个MXML接口并实现它,而是在as3中创建了一个接口.我已经在4个不同的类中实现了这个接口.
然后,我创建了4个不同的vbox容器,每个容器都有一个脚本标记中的不同实现.
这听起来像是一种合理的方法,还是我反对这里的粮食?
编辑 - 添加示例
界面
package components.content.contents
{
public interface IContent
{
function init():void;
function doSearch():void
function setSearchTerm(term:String):void
}
}
Run Code Online (Sandbox Code Playgroud)
实施(1/4)
package components.content.contents
{
public class ClipContent extends AbstractContent implements IContent
{
public function ClipContent()
{
}
public function init():void
{
}
public function doSearch():void
{
}
public function setSearchTerm(term:String):void
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
MXML文件(1/4)
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script>
<![CDATA[
// ClipContent Container
import components.content.contents.ClipContent;
public var content:ClipContent= new ClipContent()
public function …Run Code Online (Sandbox Code Playgroud) 我想知道c/cocoa中的块是否在主线程的单独线程上运行.它们是否有助于执行计算昂贵的代码,同时让UI响应?
我有一个看起来像这样的字符串。这是一个不带连字符的 UUID:
'0613ff4c000c0e08dda69667dc7d6c5b'
Run Code Online (Sandbox Code Playgroud)
如何将此字符串格式化为带有连字符的典型 UUID,如下所示:
'0613ff4c-000c-0e08-dda6-9667dc7d6c5b'
Run Code Online (Sandbox Code Playgroud) objective-c ×4
iphone ×3
cocoa-touch ×2
apache-flex ×1
c ×1
copy ×1
core-audio ×1
core-data ×1
interface ×1
ios4 ×1
mxml ×1
nsstring ×1
performance ×1
python ×1
retain ×1
tags ×1
uibutton ×1
uikit ×1
uuid ×1
volume ×1