Tag: cocoa touch

How to include and use new fonts in iPhone SDK?

I want to use font “MgOpen Modata” in my iphone App. But I dont see it in the font list in Property inspector. How do I include that font so that I can use it?

Has anyone implemented the PayPal API through a native iPhone app?

It seems the only way to stay “in app” is to give them a UIWebView of the paypal mobile site and let them complete the transaction there, otherwise the user would need to use their API key. Does this sound right and has anyone got or seen any sample code? I have to think this […]

Underscore prefix on property name?

Possible Duplicate: How does an underscore in front of a variable in a cocoa objective-c class work? Can anyone point me to an explanation of the use of underscores, I have always assumed that they are used to highlight that you are accessing the iVar [_window release]; rather than accessing the iVar via a setter/getter […]

OpenGL Texture Coordinates in Pixel Space

I’m working on an iPhone app that uses OpenGL ES 2 for its drawing. I know that typically texture coordinates are defined in the 0-1 range, but ideally I’d like to map them from 0-1023 (the size of my TextureAtlas) for readability’s sake. I’ve seen sample code that defines coordinates in this manner, but haven’t […]

How to send json data in the Http request using NSURLRequest

I’m new to objective-c and I’m starting to put a great deal of effort into request/response as of recent. I have a working example that can call a url (via http GET) and parse the json returned. The working example of this is below – (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [responseData setLength:0]; } – (void)connection:(NSURLConnection […]

How to scale a UIImageView proportionally?

I have a UIImageView and the objective is to scale it down proportionally by giving it either a height or width. UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@”http://img.ioscake.com/objective-c/2915896504_a88b69c9de.jpg”]]]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; //Add image view [self.view addSubview:imageView]; //set contentMode to scale aspect to fit imageView.contentMode = UIViewContentModeScaleAspectFit; //change width of frame CGRect […]

How to Check if an NSDate occurs between two other NSDates

I am trying to figure out whether or not the current date falls within a date range using NSDate. For example, you can get the current date/time using NSDate: NSDate rightNow = [NSDate date]; I would then like to use that date to check if it is in the range of 9AM – 5PM.

How do i add 1 day to a NSDate?

Basically, as the title says. I’m wondering how I could add 1 day to an NSDate. So if it were: 21st February 2011 It would become: 22nd February 2011 Or if it were: 31st December 2011 It would become: 1st January 2012.

Having trouble adding objects to NSMutableArray in Objective C

I am using the iPhone SDK and have an issue doing something simple. I am trying to add an NSNumber object to an NSMutableArray instance variable. I tried adding NSNumber card to NSMutableArray viewedCardsArray, however without breaking, it does not get added to the array. Here is the code. ///////////////////////////////////////////////////// // Inside the header file […]

Objective C HTML escape/unescape

Wondering if there is an easy way to do a simple HTML escape/unescape in Objective C. What I want is something like this psuedo code: NSString *string = @”&lt;span&gt;Foo&lt;/span&gt;”; [string stringByUnescapingHTML]; Which returns <span>Foo</span> Hopefully unescaping all other HTML entities as well and even ASCII codes like Ӓ and the like. Is there any methods […]