小编Rob*_*way的帖子

UITapGestureRecognizer - 让它在降落时工作,而不是修饰?

我正在使用tap事件是非常时间敏感的,所以我很好奇是否有可能在用户简单触摸时激活UITapGestureRecognizer,而不是要求它们也能触摸起来?

objective-c ios uitapgesturerecognizer swift

78
推荐指数
3
解决办法
5万
查看次数

Parse的可扩展性如何?

我一直在考虑将Parse.com的服务用于我的后端,但我对它的可扩展性持怀疑态度.

它能真正处理几千个并发用户吗?如果没有,他们有什么好的方式从它过渡?

iphone parsing scalability parse-platform

55
推荐指数
8
解决办法
2万
查看次数

将生成的GIF保存到相机胶卷?

谢谢阅读.我使用此问题中的方法创建了一个GIF:

通过iOS创建和导出动画gif?

我试图用这似乎是一个能够不JPG/PNG图像保存至相机胶卷的唯一方法,ALAssetLibrarywriteImageDataToSavedPhotosAlbum:metadata:completionBlock:

我将Gif保存到临时目录中,如下所示:

NSString *exportPath = [NSTemporaryDirectory() stringByAppendingString:@"/animated.gif"];
NSURL *fileURL = [NSURL fileURLWithPath:exportPath isDirectory:NO];
Run Code Online (Sandbox Code Playgroud)

然后访问NSData类似:

NSData * gifData = [NSData dataWithContentsOfFile:fileURL.absoluteString];
Run Code Online (Sandbox Code Playgroud)

因为我能够在显示它的GIF创建UIImageView,但是当我试图挽救它,该方法返回一个成功(没有错误),但实际上并没有保存(返回NilNSURL * assetURL并没有出现在摄像头滚).

如何让我的GIF成功保存到相机胶卷?

xcode objective-c gif ios alassetslibrary

10
推荐指数
2
解决办法
6346
查看次数

Restkit MultiForm发布图像

问题

我一直在尝试使用包含图像附件的多表单请求发布到服务器.我没有遇到将图像传送到服务器的问题,这是其他信息无法正确发送.

细节

我正在使用对象映射来从服务器接收对象时配置几个不同的属性:

//Using a custom class to map object I receive to
RKObjectMapping * memoryMapper = [RKObjectMapping mappingForClass:[MemoContent class]];
[memoryMapper mapAttributes:@"created", @"user", @"participants", @"tags", @"text", @"kind", @"video", @"location", nil];
[memoryMapper mapKeyPath:@"_id" toAttribute:@"memoryID"];

//MediaMapper handles the data needed for the Image attachments
RKObjectMapping * mediaMapper = [RKObjectMapping mappingForClass:[MemoMedia class]];
[mediaMapper mapKeyPath:@"processed" toAttribute:@"processed"];
[mediaMapper mapKeyPath:@"original" toAttribute:@"original"];
[mediaMapper mapKeyPath:@"mime" toAttribute:@"mimeType"];
[memoryMapper mapKeyPath:@"media" toRelationship:@"rawMedia" withMapping:mediaMapper];

//
[[RKObjectManager sharedManager].mappingProvider setMapping:memoryMapper forKeyPath:@"memories"];
[RKObjectManager sharedManager].serializationMIMEType = RKMIMETypeFormURLEncoded;
[RKObjectManager sharedManager].acceptMIMEType = RKMIMETypeJSON;
Run Code Online (Sandbox Code Playgroud)

然后,当发布照片时,我更新配置如下:

 RKObjectMapping * memoryMapper …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios restkit

7
推荐指数
2
解决办法
5507
查看次数

让UICollectionView从右向左滚动?

水平设置时UICollectionView滚动的自然方向是从左到右.有没有办法扭转这种局面?越简单越好.

iphone cocoa-touch objective-c uiscrollview uicollectionview

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

Xcode Bots服务器持续集成失败

我试图使用Xcode机器人集成进行单元测试时遇到此错误:

Integration failed. Unexpected error while building. See the integration's logs for more details.

我无法理解日志.他们几乎吐出了系统的任何错误,无论是否相关.

我使用来自Github的远程存储库,目前只在一台设备上进行测试.我是.来自Xcode的标准资料.

以下是我能找到的日志中最相关的消息:

'2014-01-01 10:03:04.195 xcodebuild[19150:100b] Error opening /var/teamsserver/Library/Logs/iOS Simulator/iOS Simulator.log'

Symbols directory specified does not exist at /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKitBase.framework/Resources/sync_ddi line 17.

xcodebuild: error: No destinations were specified with the -destination flag which were valid for the specified scheme 'MyTestsScheme'.

报道的最后一个是第三个.似乎也是最直接相关的.有任何想法吗?

xcode objective-c osx-server ios swift

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

AVFoundation:导出时正确地将视频适合 CALayer

问题:

我在获取使用 AVFoundation 创建的视频以在 VideoLayer a 中显示CALayer正确尺寸时遇到问题。

例子:

以下是视频的外观(在应用中向用户显示)

在此处输入图片说明

但是,这是导出时的结果视频:

在此处输入图片说明

细节

如您所见,它是一个方形视频,背景为绿色,视频适合指定的帧。但是,生成的视频不适合CALayer用于包含它的视频(请参阅视频应拉伸到的黑色空间?)。

有时,视频确实填满了图层,但超出了边界(宽度过大或高度过大),并且通常无法保持视频的自然宽高比。

代码

CGRect displayedFrame = [self adjustedVideoBoundsFromVideo:gifVideo];//the cropped frame
CGRect renderFrame = [self renderSizeForGifVideo:gifVideo]; //the full rendersize
AVAsset * originalAsset = self.videoAsset;

AVAssetTrack * videoTrack = [[originalAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];
AVMutableComposition * mainComposition = [AVMutableComposition composition];

AVMutableCompositionTrack * compositionTrack = [mainComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];

[compositionTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, originalAsset.duration) ofTrack:videoTrack atTime:kCMTimeZero error:nil];

CALayer * parentLayer = [CALayer layer];
CALayer * backgroundLayer = [CALayer layer];
CALayer * videoLayer = …
Run Code Online (Sandbox Code Playgroud)

core-animation objective-c avfoundation calayer ios

4
推荐指数
2
解决办法
1781
查看次数

iOS:addConstraints:崩溃的应用程序

问题

我似乎无法将Auto Layout应用到我现有的项目中.

细节

之前我遇到了同样的问题,因为这个问题presentViewController:在iOS <6(AutoLayout)上崩溃但是没有提供的答案对我来说是一个解决方案:我正在使用没有xib的所有故事板视图.我的"使用自动布局"设置已经关闭,我只使用iOS 6.

我的视图控制器最初崩溃,所以我设置了延迟添加的约束,现在我的应用程序在任何addConstraints:调用期间崩溃.最糟糕的是它不会告诉我原因.

我将链接我的代码,但它很直接.

-(void)addAllConstraints
{
    NSDictionary * views = NSDictionaryOfVariableBindings(_memoryImage, _peopleView, _contentHolder, _commentsTableView);
    NSArray * constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[_memoryImage]-50-[_peopleView]-0-[_contentHolder]-0-[_commentsTableView]" options:0 metrics:nil views:views];
    NSLog(@"Views %@, Constraints %@", views, constraints);
    [_peopleView addConstraints:constraints];
    [_memoryImage addConstraints:constraints];
    [_contentHolder addConstraints:constraints];
   [_commentsTableView addConstraints:constraints];
}
Run Code Online (Sandbox Code Playgroud)

应用程序在_peopleView调用addConstraints时崩溃了.视图和NSLayoutConstraints都已成功创建.

有任何想法吗?谢谢,节日快乐.

编辑:

添加崩溃日志以显示没有任何有用的信息显示:

2012-12-25 10:40:13.936 -----[4955:907] Views {
"_commentsTableView" = "<UITableView: 0x1eb6be00; frame = (0 372; 320 100); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x1e51ce00>; layer = <CALayer: 0x1e51cee0>; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios nslayoutconstraint

3
推荐指数
1
解决办法
2946
查看次数

从iOS 8中的PHAsset获取文件扩展名?

有没有办法区分PHAsset的文件扩展名?我的应用需要知道照片是否是.GIF.我没有看到任何方法这样做.

xcode objective-c ios ios8

3
推荐指数
2
解决办法
5538
查看次数