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
0
votes
1 answer

Return CGValues Resulting in Xcode Error

So I have a function that when called, needs to return a CGFloat value. However, Xcode responds with an error saying: "CGFloat is not convertible to ()". I have looked around the web, but none of the conversions seem to be working for me. Here is my…
24GHz
  • 80
  • 1
  • 15
0
votes
1 answer

Swift Xcode 6.1 broke my code | Operand error

So whenever I have this: let result = SKScrollingNode(color: UIColor.clearColor(), size:CGSizeMake(CGFloat(containerWidth), image.size.height)); I get a compilation error for the image.size.height, telling me that "'UIImage?' does not have a…
Sarah
  • 313
  • 3
  • 10
0
votes
1 answer

Swift: Error saving UIColor to NSUserDefaults (CGFloat is not convertible to Float)

I'm trying to save the RGB values of a UISlider but getting the following error: 'CGFloat' is not convertible to 'Float' private func saveDisplayColor() { var color = sliderView.backgroundColor let colors =…
Richard
  • 1,688
  • 3
  • 16
  • 21
0
votes
1 answer

Cannot invoke '+' with an argument list of type '(frame: CGRect)'

I am trying to create a UIView from a CGRect frame. Every parameter in CGRectMake() are CGFloats. var views:UIView = UIView(frame:CGRectMake(CGFloat(hotspotScroll.frame.size.width * i + 20), CGFloat(10),CGFloat(hotspotScroll.frame.size.width - 40),…
Gearbox
  • 336
  • 3
  • 15
0
votes
1 answer

"Int is not convertible to CGFloat" error when subclassing UIImageView

I have a weird bug here. I'm subclassing UIImageView to pass some custom properties to my views. If I don't add an init method to my subclass, everything's fine. But if I do add the init (and I'm required to do so), then when I'm creating the…
0
votes
1 answer

Assigning CGRect Expression to CGFloat - Swift

I'm looking to assign below attributes with some values, however having a majorly complex time with the errors I keep getting back. override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]! { var padding:CGFloat = 100.0 …
Fudgey
  • 3,793
  • 7
  • 32
  • 53
0
votes
1 answer

Converting Int to CGFloat results in 0.000000

I am attempting to take Int values from an Array and convert them into CGFloats so that I may create a UIColor from those red, green, and blue values. Simple enough, right? I can successfully get the Int values out of the array, but when I attempt…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
0
votes
2 answers

How to Calculate Scrollview width and height on every scroll in iOS

I have Scrollview using for displaying images along with two buttons previous and next. Now my problem is when the user is scrolling the image I want to identify whether it is from right to left scroll or vice versa. For this purpose I have to…
siri
  • 17
  • 5
0
votes
0 answers

Sending the correct NSNumber message for float or double data types?

Being the thoughtful (and really good-looking) developer that I am, I always use CGFloat when assigning float/double values, and the same goes for NSInteger and NSUInteger when dealing with int/long values. A thing that's been nagging me for awhile,…
Ben Stock
  • 1,986
  • 1
  • 22
  • 30
0
votes
1 answer

how to set ballon image to the right of the View?

Context: I am building a chat app, I used code from apple sample. It looks exactly like the native message app. My issue is on the iPad version I am implementing. Here's an image: As you can see in the image, I need it the righ ballon to be on the…
user3205189
0
votes
1 answer

Passing a CGFloat value from viewDidLoad to viewDidAppear

I am using a CGFloat value to set my scrollView's contentSize so that it adjusts dynamically to content populated in my textviews. I determine the heights of each text view and their positions in the viewDidLoad method, but have to set the…
Rooncicle
  • 106
  • 1
  • 11
0
votes
1 answer

Cocoa CGColorRef incompatible pointer types passing float [4]' to parameter of type 'const CGFloat *' (aka 'const double *')

I'm getting this error: my color = CGColorCreate(colorSpace, fillComponents); variable: incompatible pointer types passing 'float [4]' to parameter of type 'const CGFloat *' (aka 'const double *'). How do I solve this? CGColorRef…
spacecash21
  • 1,331
  • 1
  • 19
  • 41
0
votes
1 answer

iOS CGFloat Semantic Issues --Invalid Operands

In my interface there are two CFFloat properties. I am attempting to use them in a gesture recognizer but I continue to get the errors "invalid operands to binary expression float and double.." in the if statement with the…
user2793987
  • 199
  • 1
  • 2
  • 15
0
votes
0 answers

sqlite float comparison - is this predictable?

I have a LOCATIONS table in sqlite: CREATE TABLE LOCATIONS (LOCATION_ID INTEGER PRIMARY KEY, PLACE_NAME, CITY TEXT, COUNTRY TEXT, LAT REAL, LNG REAL, IMAGE BLOB); I'd like to implement the following method on a LocationDao -…
Jasper Blues
  • 28,258
  • 22
  • 102
  • 185
0
votes
1 answer

Assigning of floats into global array

I'm trying to customize grouped UITableViewCell's backgroundView with a gradient, based on code I find on this blog. It's a subclass of UIView for use on cell.backgroundView. The colors of the background's gradient are defined like this on the…
Maen
  • 10,603
  • 3
  • 45
  • 71