Friday, September 4th, 2009 Share on Twitter
For my current project, I have to rotate a CGImageRef by an arbitrary angle.
Here is the code:
- (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle
{
CGFloat angleInRadians = angle * (M_PI / 180);
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGRect imgRect = CGRectMake(0, 0, width, height);
...
Posted in cocoa, iPhone | 2 Comments »
Monday, January 5th, 2009 Share on Twitter
These are some of the macros I use with Xcode:
CMLog: I use this macro to replace NSLog:
#define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]);
When you use this macro, it outputs text to the console, including the class and method from where it was called. So, if you call this macro ...
Posted in cocoa, iPhone | 6 Comments »
Monday, January 5th, 2009 Share on Twitter
If, like me, you want to make sure your text will fit inside your UIWebView (without scrolling), you can implement the following javascript:
<script language='javascript' type="text/javascript">
function adjustHeight(maxHeight) {
elem = document.getElementById("sign");
height = ...
Posted in cocoa, iPhone | No Comments »
Tuesday, March 4th, 2008 Share on Twitter
A question was asked on the apple dev mailing list on how to bring a window with a certain name to the front.
Since I was already working on how to get the list of windows on the screen, I just added some AppleScript to bring the window to the front.
This ...
Posted in cocoa | 2 Comments »