Xcode CGFloat to NSInteger conversion

There are two ways to Convert From CGFloat to NSInteger.
Solution one.
Convert CGFloat to NSString, then take integer value.
CGFloat foo = 540.0f; NSInteger bar = [[NSString stringWithFormat:@"%.2f",foo] integerValue];
Solution two.
Just take Integer value.
CGFloat foo = 540.0f; NSInteger bar = (int)foo;
Additional useful Infomartion
CGFloat foo = 540.4f; CGFloat bar = ceil(foo);//541.0f round-up CGFloat bar2 = floor(foo);//540.0f round-down CGFloat bar3 = round(foo);//540.0f round