tags:

views:

154

answers:

2

Hi everyone,

is it possible to load a float value out of an internal sqlite database and use it as a variable in CGMakeRect from UIButton?

I can't get this to work :-(

Here is some of my code. Maybe someone knows how to deal with this prob!!!

self.positionX = [NSNumber numberWithFloat:(float)sqlite3_column_double(init_statement, 3)];
// other class:
imageButton.frame = CGRectMake(positionX , 100.0, 37.0, 37.0);  

The "linking" works just fine. But I get an error saying: "Incompatible type for argument.."

My types are:

  • sqlite positionX as FLOAT
  • postionX as CGFloat

Does someone have a solution for my problem???

Thanks!

A: 

You should get float value from NSNumber object:

imageButton.frame = CGRectMake([positionX floatValue] , 100.0, 37.0, 37.0);  
Vladimir
A: 

using your code I get an error: " “EXC_BAD_ACCESS” ... Do I have to change the type of the variable somehow?

How you defined property for positionX? (and did you check if it is created correctly?). And you should put extra details/questions to a comment to the answers rather to add them as an answer...
Vladimir