开发者

custom float from sqlite -> UIButton.frame CGRectMake

开发者 https://www.devze.com 2022-12-30 16:32 出处:网络
is it possible to 开发者_高级运维load a float value out of an internal sqlite database and use it as a variable in CGMakeRect from UIButton?

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!


You should get float value from NSNumber object:

imageButton.frame = CGRectMake([positionX floatValue] , 100.0, 37.0, 37.0);  
0

精彩评论

暂无评论...
验证码 换一张
取 消