小编Gre*_*gzo的帖子

viewWillTransitionToSize:vs willTransitionToTraitCollection:

谁能解释这两种方法之间的差异?UIViewController的文档明确声明viewWillTransitionToSize应该用于管理旋转,但是点击进入UIContentContainer页面,willTransitionToTraitCollection方法会让人感到困惑.

我想我理解大小类更改(特征集合更改)和大小更改之间的概念差异,但我不确定在哪种情况下实现哪种方法.来自UIKit向导的澄清会很有帮助!

rotation uiviewcontroller uikit ios

11
推荐指数
1
解决办法
3517
查看次数

PhotoKit:fetchAssetCollectionsWithLocalIdentifiers失败

以下代码通过3个简单的步骤突出了该问题:

1)获取时刻

2)缓存时刻localIdentifier

3)带有标识符的获取时刻:fail(在设备上,iOS 8.2)

- ( void )momentLocalIdTest
{
    PHFetchResult       * fetchResult;
    PHAssetCollection   * moment;
    NSString            * localIdentifier;

    fetchResult = [ PHAssetCollection fetchMomentsWithOptions: nil ];

    if( fetchResult.count == 0 )
        return;

    moment          = fetchResult.firstObject;
    localIdentifier = moment.localIdentifier;
    fetchResult     = [ PHAssetCollection fetchAssetCollectionsWithLocalIdentifiers: @[ localIdentifier ] options: nil ];

    if( fetchResult.count == 0 )
        NSLog( @"AssetCollection with localIdentifier %@ not found!!!", localIdentifier );
}
Run Code Online (Sandbox Code Playgroud)

我误会了吗?看起来很简单...

任何帮助表示赞赏!

ios photokit

5
推荐指数
1
解决办法
850
查看次数

用ExtAudioFileRead循环AAC文件 - bug?

使用ExtAudioFileRead读取iOS上的音频文件,似乎达到eof完全冻结了读者......例如,假设_abl AudioBufferList和_eaf ExtendedAudioFileRef已分配并正确配置:

- ( void )testRead
{
    UInt32 requestedFrames = 1024;
    UInt32 numFrames = requestedFrames;
    OSStatus error = 0;

    error = ExtAudioFileRead( _eaf, &numFrames, _abl );

    if( numFrames < requestedFrames ) //eof, want to read enough frames from the beginning of the file to reach requestedFrames and loop gaplessly
    {
         requestedFrames = requestedFrames - numFrames;
         numFrames = requestedFrames;
         // move some pointers in _abl's buffers to write at the correct offset
         error = ExtAudioFileSeek( _eaf, 0 );
         error = …
Run Code Online (Sandbox Code Playgroud)

audio objective-c ios extaudiofileread

4
推荐指数
1
解决办法
466
查看次数