小编Gab*_*ele的帖子

关于 - (NSDictionary)dictionaryWithObjectsAndKeys:和

我有一个非常有趣的问题.

在我的一个类中,我声明了一个非常简单的实例方法 - (NSDictionary)字典; 这是以这种方式实现的:

- (NSDictionary *)dictionary {
    return [NSDictionary dictionaryWithObjectsAndKeys:
                              self.userID, @"id",
                              self.userName, @"name",
                              self.userSurname, @"sName",
                              self.userNickname, @"nName",
                              self.userPassword, @"pwd",
                              [NSNumber numberWithDouble:[self.userBirthday timeIntervalSince1970] * 1000], @"birthday",
                              self.userSex, @"sex",
                              self.userEmail, @"email",
                              self.userLanguage, @"locale",
                              [NSNumber numberWithLongLong:self.userCoin], @"coin",
                              self.userRate, @"rate",
                              [NSNumber numberWithDouble:self.userCoordinate.latitude], @"lat",
                              [NSNumber numberWithDouble:self.userCoordinate.longitude], @"lon",
                              self.userPlaces, @"userPlaces",
                              nil];
    }
Run Code Online (Sandbox Code Playgroud)

声明了这个方法,我的返回字典中没有@"userPlaces"键(self.userPlace显然是有价值的并且充满了对象).

所以我改变了一下这样的方法:

- (NSDictionary *)dictionary {      
    NSMutableDictionary *toReturn = [NSMutableDictionary dictionary];
    [toReturn setValue:self.userID forKey:@"id"];
    [toReturn setValue:self.userName forKey:@"name"];
    [toReturn setValue:self.userSurname forKey:@"sName"];
    [toReturn setValue:self.userNickname forKey:@"nName"];
    [toReturn setValue:self.userPassword forKey:@"pwd"];
    [toReturn setValue:[NSNumber numberWithDouble:[self.userBirthday timeIntervalSince1970] * …
Run Code Online (Sandbox Code Playgroud)

iphone nsdictionary foundation

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

试图用未知的演示者解雇UIAlertController

我的应用程序崩溃了,它必须是因为UIAlertController.

仅在UIAlertController可用的iOS 8.x上会出现此问题.奇怪的是,我的应用程序不使用UIAlertViewController或UIAlertView.

报告告诉我:

Trying to dismiss UIAlertController <UIAlertController: 0x172c5d80> with unknown presenter.
Run Code Online (Sandbox Code Playgroud)

怎么会发生这种情况?

我想过

  1. 由于摇动手势,撤消系统AlertView显示
  2. 当提示或通用对话框仍在屏幕上时,WebView将被释放
  3. 低电量警报

但是没有一个案例让我陷入崩溃.

崩溃日志告诉我的是,操作系统显示一个AlertView,它将附加到我的应用程序窗口,在某些情况下,松散了呈现UIAlertViewController的父视图控制器.

任何想法如何找到问题?

这里是堆栈跟踪

_________________________________
0    CoreFoundation                         0x2bc0c45f __exceptionPreprocess + 127
1    libobjc.A.dylib                        0x39c79c8b objc_exception_throw + 36
2    CoreFoundation                         0x2bc0c3a5 +[NSException raise:format:] + 110
3    UIKit                                  0x2f4ad13d -[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 414
4    UIKit                                  0x2f4acf97 -[UIAlertController _dismissAnimated:triggeringAction:] + 28
5    UIKit                                  0x2f590a0b -[_UIAlertControllerActionView touchesEnded:withEvent:] + 160
6    UIKit                                  0x2f159567 -[UIWindow _sendTouchesForEvent:] + 520
7    UIKit                                  0x2f152e31 -[UIWindow sendEvent:] + 542
8 …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c stack-trace uialertview ios

17
推荐指数
1
解决办法
2385
查看次数

CoreAnimation,AVFoundation和进行视频导出的能力

我正在寻找将我的图片序列导出为快速视频的正确方法.

我知道AV基金会能够合并或重新组合视频,还可以添加构建单个视频资产的音轨.

现在......我的目标有点不同.我想从头开始创建一个视频.我有一套UIImage,我需要在一个视频中渲染所有这些.我阅读了有关AV Foundation的所有Apple文档,我找到了AVVideoCompositionCoreAnimationTool类,它能够获取CoreAnimation并将其重新编码为视频.我还检查了Apple提供的AVEditDemo项目,但似乎有些东西在我的项目中没有用.

我的步骤:

1)我创建了CoreAnimation Layer

CALayer *animationLayer = [CALayer layer];
[animationLayer setFrame:CGRectMake(0, 0, 1024, 768)];

CALayer *backgroundLayer = [CALayer layer];
[backgroundLayer setFrame:animationLayer.frame];
[backgroundLayer setBackgroundColor:[UIColor blackColor].CGColor];

CALayer *anImageLayer = [CALayer layer];
[anImageLayer setFrame:animationLayer.frame];

CAKeyframeAnimation *changeImageAnimation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
[changeImageAnimation setDelegate:self];
changeImageAnimation.duration = [[albumSettings transitionTime] floatValue] * [uiImagesArray count];
changeImageAnimation.repeatCount = 1;
changeImageAnimation.values = [NSArray arrayWithArray:uiImagesArray];
changeImageAnimation.removedOnCompletion = YES;
[anImageLayer addAnimation:changeImageAnimation forKey:nil];

[animationLayer addSublayer:anImageLayer];
Run Code Online (Sandbox Code Playgroud)

2)比我实例化AVComposition

AVMutableComposition *composition = [AVMutableComposition composition];
composition.naturalSize = CGSizeMake(1024, 768);

CALayer *wrapLayer = [CALayer layer];
wrapLayer.frame …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c avfoundation ios4

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

OpenGL背面纹理

我有一个女巫的游戏牌我想要模拟一个翻转动画.

所以我在我的Tile上使用glRotatef(角度,0,1,0)来模拟从180度角开始的翻转动画,这样我的瓷砖开始后翻并向我显示背面.一切都很好,但问题是,当我的瓷砖开始后翻时,我不想看到翻转的纹理.

我希望看到的结果是黑色(由顶点颜色提供)或背面的不同纹理和前脸的游戏纹理.更简单的是我想建立一种游戏卡.

任何人都可以建议我解决我的问题的方法?

iphone opengl-es

0
推荐指数
1
解决办法
1184
查看次数