我正在尝试针对运行iOS 3.1.3的朋友的旧iPod touch测试我的应用程序.
我有XCode 4并在尝试运行应用程序时收到此错误消息:
运行目标iOS设备对于运行方案"MyApp"无效.
方案"MyApp"不包含可为运行目标iOS设备支持的体系结构构建的可构建项.确保您的目标构建适用于与运行目标iOS设备兼容的体系结构.
我已将部署目标设置为iOS 3.1.3.我还需要在XCode 4中做些什么来在这款旧iPod touch上构建和测试应用程序?
我正在使用"标准"构建架构,未进行优化.
我有一个自定义的UITableViewCell,它根据它所在的行改变颜色:
TableViewController.m
- (void)willDisplayCell:(GSRSongCell *)cell atIndexPath:(NSIndexPath *)indexPath;
{
if (indexPath.row % 2 == 0) {
[cell lighten];
} else {
[cell darken];
}
}
Run Code Online (Sandbox Code Playgroud)
CustomTableViewCell.m
- (void)lighten
{
self.selectedBackgroundView.backgroundColor = [UIColor whiteColor];
self.contentView.backgroundColor = [UIColor whiteColor];
self.primaryLabel.backgroundColor = [UIColor whiteColor];
self.secondaryLabel.backgroundColor = [UIColor whiteColor];
}
- (void)darken
{
UIColor *darkColor = [UIColor colorWithR:241 G:241 B:241 A:1];
self.selectedBackgroundView.backgroundColor = darkColor;
self.contentView.backgroundColor = darkColor;
self.primaryLabel.backgroundColor = darkColor;
self.secondaryLabel.backgroundColor = darkColor;
}
Run Code Online (Sandbox Code Playgroud)
然而,当我打电话时deselectRowAtIndexPath:animated:YES
,动画会在细胞中逐渐消失为白色selectedBackgroundColor
.
然后我意识到取消选择动画与之无关selectedBackgroundColor
; 实际上,取消选择动画实际上是基于tableView.backgroundColor
属性的! …
我正在制作一个iOS应用程序,可让您远程控制桌面上播放的应用程序中的音乐.
最难的问题之一是能够正确地更新"跟踪器"的位置(其显示当前正在播放的歌曲的时间位置和持续时间).这里有几个输入源:
目前,跟踪器是一个UISlider,由"玩家"模型支持.每当用户更改滑块上的位置时,它都会更新模型并发送网络请求,如下所示:
在NowPlayingViewController.m中
[[slider rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(UISlider *x) {
[playerModel seekToPosition:x.value];
}];
[RACObserve(playerModel, position) subscribeNext:^(id x) {
slider.value = player.position;
}];
Run Code Online (Sandbox Code Playgroud)
在PlayerModel.m中:
@property (nonatomic) NSTimeInterval position;
- (void)seekToPosition:(NSTimeInterval)position
{
self.position = position;
[self.client newRequestWithMethod:@"seekTo" params:@[positionArg] callback:NULL];
}
- (void)receivedPlayerUpdate:(NSDictionary *)json
{
self.position = [json objectForKey:@"position"]
}
Run Code Online (Sandbox Code Playgroud)
问题是当用户"摆弄"滑块时,会排队一些网络请求,这些请求都会在不同时间返回.当收到响应时,用户可能已经再次移动滑块,将滑块移回到先前的值.
我的问题:如何在此示例中正确使用ReactiveCocoa,确保处理来自网络的更新,但仅限于用户之后没有移动滑块?
我希望用户在我的应用程序中接收完成各种任务的"积分" - 从标记对象到交友等任务.我还没有找到一个简化这个的Django应用程序.
目前我认为积累积分的最佳方式是每个用户操作创建相当于"流项目"的积分,并通过计算发布到其流的每个操作的值来计算积分.
显然,社交游戏机制是一个很大的领域,目前正在进行大量的研究.但从发展的角度来看,最简单的入门方式是什么?我是在错误的轨道上还是有更好/更简单的方法?
编辑:对于任何想要非常简单的实现的人:
对于那些对这个想法非常简单的实现感兴趣的人,尝试创建一个"日志记录"应用程序并将其放在models.py中:
log_models = [Tag, Post, Vote]
class Point(models.Model):
# model fields
def increase_score(sender, instance, signal, *args, **kwargs):
# score logic
for model in log_models:
post_save.connect(increase_score, sender=model)
post_delete.connect(decrease_score, sender=model)
Run Code Online (Sandbox Code Playgroud)
如果您发现post_save发出两次,请参阅此文档:http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave
根据unixtimestamp.com - 2013年12月31日午夜时间戳为1388448000.
那为什么会这样呢?
在ViewController.m
:
NSDateFormatter *titleFormatter = [[NSDateFormatter alloc] init];
_titleFormatter = titleFormatter;
Run Code Online (Sandbox Code Playgroud)
在LLDB:
(lldb) po [NSDate dateWithTimeIntervalSince1970:1388448000]
2013-12-31 00:00:00 +0000
(lldb) p [NSDate dateWithTimeIntervalSince1970:1388448000]
(id) $1 = 0x16e5c0b0
(lldb) po [self.titleFormatter stringFromDate:$1]
December 2014
Run Code Online (Sandbox Code Playgroud)