Questions tagged [cgfloat]

A CGFloat is the basic CoreGraphics type for all floating-point values in the Cocoa and Cocoa Touch UI frameworks.

A CGFloat is the basic CoreGraphics type for all floating-point values in the Cocoa and Cocoa Touch UI frameworks.

CGFloat is defined in the CGGeometry Reference of CoreGraphics, which defines structures for geometric primitives and functions that operate on them. Depending on your platform, a CGFloat is either 32 or 64 bits.

Use this tag when asking questions on CGFloat value types themselves, or CoreGraphics functions which use them.

207 questions
-1
votes
3 answers

Convert Hex string to IEEE 754 float

I am trying to convert a nsstring with hex values into a float value. NSString *hexString = @"3f9d70a4"; The float value should be = 1.230. Some ways I have tried to solve this are: 1.NSScanner -(unsigned int)strfloatvalue:(NSString *)str { …
ribbit
  • 13
  • 6
-1
votes
3 answers

Trying to store float within NSInteger (or find out how to store it in something else)

I am trying to store the height of the screen in NSInteger. NSInteger *screenHeight = self.view.frame.size.height; I also tried to store it in NSString and NSNumber, but there is always an error that says Initializing 'NSInteger' (aka 'int*') with…
Alex3179
  • 1
  • 1
-2
votes
2 answers

CGFloat Multiple value in Objective C

I noticed that in Swift you can pass multiple values into a CGFloat thing that is not possible in Objective c. Here's an example: let array: [CGFloat] = [0.0, 0.0, 0.0, 0.0] I need to get multiple values for a NSLayoutConstraint.constant, can you…
kAiN
  • 2,559
  • 1
  • 26
  • 54
-2
votes
2 answers

Swift Error - 'Cannot invoke value of type 'SwiftStockChart.LabelForValueGetter' (aka'(CGFloat) -> String') with argument list '(Value:CGFloat)'

I am getting two errors when I am trying to set the chart points from the Yahoo Finance API using Swift. The first error says 'Cannot invoke value of type 'SwiftStockChart.LabelForValueGetter' (aka'(CGFloat) -> String') with argument list…
James
  • 13
  • 3
-2
votes
1 answer

I have a CGFloat value and I want to add another CGFloat value and display it using random numbers in ios

I want to add two CGFloat numbers and display them using random numbers, but don't know how to do that.. My code is : CGFloat latitude = 31.303702; CGFloat longitude = 75.594905; and the value I want to add to both cgfloat values is CGFloat…
-2
votes
3 answers

How to get the mid point of origin?

How to get x1 &x2 origin? self.spinner=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; float x1,x2,y1,y2; x1=self.view.frame.origin.x; x2=self.view.frame.origin.x; …
Kishore Kumar
  • 4,265
  • 3
  • 26
  • 47
-2
votes
3 answers

Why 0.9 is equal to 0.89999997615814208?

I am reading from a txt file and populating a core data entity. At some point I have read the value form the TXT file and the value is @"0.9". Now I assign it to a CGFloat. CGFloat value = (CGFloat)[stringValue floatValue]; debugger shows value as…
Duck
  • 34,902
  • 47
  • 248
  • 470
-3
votes
1 answer

How to obtain a reference to a CGFloat using init() in Swift?

I am new to programming with Swift (with a Java background) and I am trying to initialise a CGFloat using the init() method. I also need a reference to CGFloat after it is initialised. I keep trying this like I'd do in Java: CGFloat _cgFloat =…
user1841702
  • 2,683
  • 6
  • 35
  • 53
-3
votes
3 answers

Converting String to Float is not giving exact value in iOS

I wrote a sample to convert string to float in Objective-C: NSString *sampleFloatString = @"1.3"; float sampleFloatValue = [sampleFloatString floatValue]; But when I display sampleFloatValue, it shows '1.29999995'. I know it's equal to 1.3, but why…
Ashok
  • 5,585
  • 5
  • 52
  • 80
-3
votes
1 answer

What is the easiest way to keep track of scores?

I'm looking to have a system where it updates the score the user has if they get the answer right in a multiple choice question. I have an IBAction that runs when the user selects the right choice and I want it to update the score. i.e. score + 2…
user1282180
  • 1,103
  • 3
  • 11
  • 20
-4
votes
1 answer

CGFloat value in iOS

I am new to iOS, I Want CGFloat value of this image when i enter this values, static const CGFloat colors [] = { 0.3, 0.2, 1.0, 0.8, 0.3, 0.3, 1.0, 1.0 }; i am getting output like this, I did lot of researching but didnt success, can…
Krunal
  • 6,440
  • 21
  • 91
  • 155
-5
votes
1 answer

'<' is not a prefix unary operator

I want to make an if statement with an greater than symbol in it. When I type the code it gives me this error: ''<' is not a prefix unary operator' This is my code: if messages.count == >75 { navigationItem.rightBarButtonItem?.isEnabled =…
top1402
  • 1
  • 3
1 2 3
13
14