2014-02-21 32 views
-2

这里是我的代码:翻译红宝石用于rubymotion

- (CGFloat)layoutManager:(NSLayoutManager *)layoutManager lineSpacingAfterGlyphAtIndex:  (NSUInteger)glyphIndex withProposedLineFragmentRect:(CGRect)rect 
{ 
    return 20; 
} 
+1

对你有好处,你有你的答案,但Stack Overflow不是代码翻译服务。 –

+0

这不仅仅是他要求的翻译。我确信他想知道什么不适合他。 – Abdo

+0

@Neil Slater所以,下次我应该在哪里接受我的翻译请求? –

回答

1
def layoutManager(layoutManager, lineSpacingAfterGlyphAtIndex:glyphIndex withProposedLineFragmentRect:rect) 
    20 
end 

从这里开始:http://www.rubymotion.com/developer-center/guides/getting-started/

+0

已经通过了这本书和书。没有那么有用,iOS仍然让我困惑,因为我只有一个rails背景 –

+1

我可以理解,我也经历了这个......但是这个页面上的几个例子给你提供了将Objective-C方法转换成Ruby的语法。 'application:didFinishLaunchingWithOptions'的例子。 – siekfried

1

应该是这样的:

def layoutManager(layoutManager, lineSpacingAfterGlyphAtIndex: nil, withProposedLineFragmentRect: nil) 
    return 20.0 
end 

检查the repo的例子。
此外,该方法应该返回一个浮点数,而不是一个int。