我有这个格式化的字符串,我正在翻译工作.
英语
"Check out the %1$@ %2$@ in %3$@: %4$@" = "Check out the %1$@ %2$@ in %3$@: %4$@"
德国翻译
"Check out the %1$@ %2$@ in %3$@: %4$@" = "Hör Dir mal %2$@ in %3$@ an: %4$@";
这些传递给一个[NSString stringWithFormat:]电话:
//////////////////////////////////////
// Share Over Twitter
NSString *frmt = NSLocalizedString(@"Check out the %1$@ %2$@ in %3$@: %4$@", @"The default tweet for sharing sounds. Use %1$@ for where the sound type (Sound, mix, playlist) will be, %2$@ for where the audio …Run Code Online (Sandbox Code Playgroud) 我正在寻找一个好的gem /插件来将用户上传的音频文件转换为不同的格式.我感兴趣的一种格式是转换为带有ima4压缩的Apple .caf,以包含在iPhone应用程序中.
到目前为止,我一直在我的mac上使用afconvert,但我需要在我的linux机箱,服务器端进行此操作.理想情况下,我可以使用回形针.
作为一个额外的解决方案,ffmpeg可以工作,但我还没有看到任何.caf选项.谁知道一个?
我已经在AppStore中提交了我的两个应用程序.它现在获得批准并在AppStore中展示.如果我想看看每天有多少下载,我可以去哪里看看?我可以使用我的开发者帐户查看或其他任何地方吗?
谢谢.
我在这里结束了,并且正在向大家求助于这个f*#$ ^编码问题.
我在Dreamhost上具有root权限的私有服务器上运行.这里有一些关于我的环境和版本.
$ `which ruby` -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
$ `which bundle` -v
Bundler version 1.0.15
$ `which rails` -v
Rails 3.0.9
Run Code Online (Sandbox Code Playgroud)
除了这个错误,我的rails应用程序运行良好没有问题.但是,当我尝试使用以下encode方法更改编码字符串时:
NoMethodError: undefined method `encode' for "foobar":String
Run Code Online (Sandbox Code Playgroud)
encode 应该定义,但它不是!Encoding如果我尝试进入,我会发现irb:
$ irb
ruby-1.9.2-p180 :001 > Encoding
=> Encoding
ruby-1.9.2-p180 :002 > "foobar".encode('utf-8')
=> "foobar"
Run Code Online (Sandbox Code Playgroud)
但是如果我尝试通过bundle exec使用rails控制台,Encoding则找不到:
$ bundle exec rails c staging
Loading staging environment (Rails 3.0.9)
ruby-1.9.2-p180 :001 > Encoding
NameError: uninitialized constant Encoding
from …Run Code Online (Sandbox Code Playgroud) 在iOS上,有一个UIDevice类,可以让您获得有关设备模型,操作系统等的大量信息......
我在Mac上寻找相同的东西.我知道system_profiler从命令行调用,但即使mini设置需要几秒钟来获取任何信息.
我对从Mac应用程序中获取机器类型(Macbook Air,Mac Mini等),操作系统版本以及其他快速机器详细信息的快速方法感兴趣.详细信息将用作从应用程序内发送的支持电子邮件的页脚.有没有相当于UIDevice,或另一种快速的方法来获得一些可以帮助描述用户的机器的信息?
我有一个邪恶的时间试图让图像显示在一个CALayer.contents.它似乎相当直接,但无论我做什么,我都无法渲染图像.在CALayer我可以看到它的背景颜色和圆角半径,但图像不会加载渲染罚款.

你在这里看到的是一个CAGradientLayer应用了蒙版的子类.内部正方形是我希望图像显示的位置,并且它被添加为子CAGradientLayer类的子图层.
设置它的代码非常简单.在init:
self.imageLayer = [CALayer layer];
self.imageLayer.cornerRadius = kDefaultCornerRadius;
self.imageLayer.backgroundColor = [UIColor darkGrayColor].CGColor;
[self addSublayer:self.imageLayer];
Run Code Online (Sandbox Code Playgroud)
然后,我设置图像:
- (void)setImage:(UIImage *)image {
self.imageLayer.contents = (id)image.CGImage;
[self.imageLayer setNeedsDisplay];
}
Run Code Online (Sandbox Code Playgroud)
最后,在setFrame:
CGFloat imageSize = self.bounds.size.width - 2*kDefaultMargin;
[self.imageLayer setBounds:CGRectMake(0.0, 0.0, imageSize, imageSize)];
[self.imageLayer setPosition:CGPointMake(self.bounds.size.width/2.0f, kDefaultMargin + imageSize/2.0f)];
[self.imageLayer setNeedsDisplay];
Run Code Online (Sandbox Code Playgroud)
我已经知道或检查过的事情:
[UIImage imageNamed:@"info.png"]正在代码中的其他地方使用,实际上是显示和图像.1x时为16x16,2x时为32x32init,setImage:,setFrame;这里发生了什么?
我有一个包含状态的弹出状态栏应用程序NSTableView。当将一行拖到表外时(拖放在这里完全起作用,这不是问题的重点),我将光标更改为the指针,否则称为[NSCursor disappearingItemCursor]:
- (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)screenPoint {
if (self.draggedRowCanBeDeleted) {
BOOL outside = !NSPointInRect(screenPoint, window.frame);
if (outside) {
[[NSCursor disappearingItemCursor] set];
} else {
[[NSCursor arrowCursor] set];
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是非常不可靠的,因为有时它有时不起作用。它通常在第一次尝试时起作用,但是在此之后退出工作。我似乎找不到我要拖动的东西或拖动行进多远等的模式,只是看起来很不稳定。我在这里做错什么了吗?如果没有,我可以做些什么来帮助诊断问题吗?
更新
我也尝试了push/ pop路由,问题仍然存在。
- (void)draggingSession:(NSDraggingSession *)session movedToPoint:(NSPoint)screenPoint {
if (self.draggedRowCanBeDeleted) {
BOOL outside = !NSPointInRect(screenPoint, window.frame);
if (outside) {
if (!_showingPoof) {
_showingPoof = YES;
[[NSCursor disappearingItemCursor] push];
}
} else {
if (_showingPoof) {
_showingPoof = NO;
[[NSCursor disappearingItemCursor] pop];
// …Run Code Online (Sandbox Code Playgroud) 我正在创建自己的带有渐变背景的UITableViewCells.我已经完成了所有的逻辑和绘图,但我想解决的一件事是我的自定义单元格角落周围的"厚片":
如果你放大角落,你可以看到我在说什么.这是我用来生成单元格的代码:
CGContextRef c = UIGraphicsGetCurrentContext();
CGColorSpaceRef myColorspace = CGColorSpaceCreateDeviceRGB();
CGGradientRef myGradient = nil;
CGFloat components[8] = TABLE_CELL_BACKGROUND;
CGContextSetStrokeColorWithColor(c, [[UAColor colorWithWhite:0.7 alpha:1] CGColor]);
CGContextSetLineWidth(c, 2);
CGContextSetAllowsAntialiasing(c, YES);
CGContextSetShouldAntialias(c, YES);
CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ;
CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ;
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, minx, miny);
CGPathAddArcToPoint(path, NULL, minx, maxy, midx, maxy, kDefaultMargin);
CGPathAddArcToPoint(path, NULL, maxx, maxy, maxx, miny, kDefaultMargin);
CGPathAddLineToPoint(path, NULL, maxx, miny);
CGPathAddLineToPoint(path, NULL, minx, …Run Code Online (Sandbox Code Playgroud) 在使用NSStatusItem自定义视图的应用中,如下所示:

...如何在以下情况下收到通知:
当项目更改位置时,两者都是将自定义视图移动到正确位置所必需的.
我正在寻找一个我的iPhone应用程序的Mac版本,并正在寻找一个良好的hit来开始运行.我知道如何在Objective-c和Cocoa中编码,如果必须的话,我知道如何从头开始拼凑一些东西,但我正在寻找一种更简单的方法.
是否有任何用于编码Mac桌面应用程序的开源模板,我可以使用它来开始使用而无需重新发明轮子?
我想我正在寻找的是一个简单的方法来开始具有"iTunes外观和感觉"的应用程序.如果将这种布局的某些简单版本作为某种模板项目,那就太棒了.另外,为什么有人会对这个问题进行投票?我问过一些不适合SO的东西吗?
cocoa ×4
iphone ×4
macos ×3
objective-c ×3
audio ×1
bundler ×1
calayer ×1
encoding ×1
graphics ×1
ios ×1
localization ×1
nscursor ×1
nsstatusitem ×1
nstableview ×1
plugins ×1
profiler ×1
ruby ×1
ruby-1.9.2 ×1
rvm ×1
smoothing ×1
stroke ×1
templates ×1