2014-02-21 30 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。