Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Fuzzy graphics when CGRect given float value

joncjonc Posts: 313Registered Users
edited June 2008 in iPhone SDK Development
Has anyone else noticed that UIObjects are fuzzy if you set any of their values in the rect of their frame to float values? This makes sense, but I wasn't sure if it was intended behavior. For example, I have a label that I wan't to place dynamically depending on the size of a cell's content view:
weightLbl.frame = CGRectMake((self.contentView.frame.size.width * 0.445), weightLbl.frame.origin.y, weightLbl.frame.size.width, weightLbl.frame.size.height);

If I use that line the label shows up a little bit "fuzzy" looking on the screen. I figured out a workaround though, I just have to cast the result of that multiplication as an int, like this:
weightLbl.frame = CGRectMake(((int)(self.contentView.frame.size.width * 0.445)), weightLbl.frame.origin.y, weightLbl.frame.size.width, weightLbl.frame.size.height);

I would think that it would convert the frame to an integer just thinking from a graphics perspective. Do you all think that is supposed to be happening?
Post edited by jonc on


Sign In or Register to comment.