cgfloat

    1熱度

    1回答

    我需要有人鍵入一個值爲「40」,然後該應用程序將其轉換爲另一個值除以7.5。目前,我已經做了: NSString *pCO2 = _pCO2.text; float thepCO2 = [pCO2 floatValue]; NSInteger newpCO2 = thepCO2/7.5; NSString *finalpCO2 = [NSString stringWi

    1熱度

    2回答

    我試圖創建一個需要CGFloat參數並返回CGFloat 。 CGFloat (^debt)(CGFloat) = ^(CGFloat myFloat) { return myFloat * 444563.4004; }; 這個定義有什麼問題?爲什麼我得到這個警告?

    3熱度

    2回答

    可能重複: CGFloat addition bug? 我有一個CGPoint(這僅僅是圍繞着兩個CGFloats一個struct)。能向我有人解釋如何的這兩行代碼: player.position = CGPointMake(player.position.x + 12.8f, player.position.y + 12.8f); NSLog(@"%f,%f", player.positio

    0熱度

    1回答

    我想用漸變自定義分組的UITableViewCell的backgroundView,基於我找到的代碼on this blog.它是用於cell.backgroundView的UIView的子類。 背景的漸變的顏色被這樣限定在原來的代碼: #define TABLE_CELL_BACKGROUND { 1, 1, 1, 1, 0.866, 0.866, 0.866, 1} // #FFFFFF

    11熱度

    1回答

    問題 考慮這樣的佈局代碼: CGFloat descriptionHeight = // height of a paragraph of text with zero or more words; CGFloat imageHeight = // height of an image; CGFloat yCoordinateOfSomeOtherView = fmax(description

    0熱度

    1回答

    我的網頁上有一個寬度爲'50px',高度爲'40px'的圖片。 現在我想在UIImageView中顯示具有相同尺寸的圖像。 如何將像素轉換爲CGFloat? 感謝您的回答。

    2熱度

    2回答

    我是新來的objective-c。我想在NSString中顯示較短的CGFloat值。我知道C很容易。但我不知道如何在Objective-c中做到這一點。 例如, CGFloat value = 0.333333; NSLog(@"%f%%",value*100); 它將顯示33.3333%。但我想把它做成33.33%。我該怎麼做?

    1熱度

    1回答

    在Objective-C(或C),如果我做 CGFloat distance = 215; CGFloat velocity = 20; NSTimeInterval time = distance/velocity; 是正確的?或者,我應該將distance還是velocity投到NSTimeInterval? 注意,在iOS的7.0: #if defined(__LP64__) &&

    0熱度

    1回答

    我有一個帶有句子的標籤,即一個字符串。我需要獲取字符串中特定單詞的x座標。例如,如果我在句子中有一句話說「狗跑了」,我需要能夠找到x和y座標以及將UITextField放在它上面的寬度和高度。這是我到目前爲止的代碼: - (void)insertTextFields:(NSString *)string inLabel:(UILabel *)label { CGFloat string

    10熱度

    2回答

    有沒有安全的方法可以將CGFloat「轉換」爲NSNumber? NSNumber有numberWithFloat:和numberWithDouble:方法,但CGFloat被定義爲根據不同的平臺float或double,似乎冒險使用其中的任何一個。 或者是numberWithDouble:安全使用CGFloat,因爲它是一個更精確?