Skip to main content

Posts

What does the origin control do in interface builder?

In interface builder there is a control in the struts and springs inspector that is labeled origin. What does this do and why does changing it for one object change it for ALL objects? As far as I can tell it doesn't have any real effect on the frame rectangle origin as the name implies. Let me explain: Selecting a UILabel and changing the origin to be at the top right as in the photo above puts the frame origin at the point (280,11). However, in code, when you actually ask the frame for it's origin it is given as (211,11) which corresponds to the top left corner of the frame. Therefore, changing the frame origin in interface builder appears to do absolutely nothing! What is going on here?!

how to write xml with objectiv-c and place it into an NSData object

I have been reading though heaps of the ios docs from apple, and almost every bit of code to do with xml on there requiers either creating a file with xml data in it or receiving xml over a connection then altering it. I would like to know if there is a way to just creat some xml.. maybe in a string, then convert it into a NSData object.. I know how to pass a nssting into a nsdata object.. thats not so much of a big deal.. the painfull part at the moment is getting some clear concise examples on how to create my own xml without all the other stuff that apple says you need.. I.e. file or return data. I currently have no code.. what I will likely do is create a method with some parameters that can receive some information and then pass them in to hopefully create a nice xml string/data object.. if you have any example code, suggestions links to decent tutorials that would be hugely helpfull :)

Issues submitting firemonkey app to app store

I have tried dozens of configuration settings trying to get this to work, but still to no avail... When I am trying to submit to the app store, the application loader is reporting the following error iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv7. My understanding is that fpc 2.4 can only generate armv6 code anyway. I have tried setting all build settings to only reference armv6, installed the previous version of XCode 3.2.6 and linked with the iOS SDK 4.3, hoping that this will address any references to armv7, but still no joy. According to the XE2 Update 4 release notes, fpc 2.6 supports armv7, but despite the release notes having been available for weeks, there is no sign of the update! Has anyone successfully uploaded an app using current tools (it surely has to be possible), and if so, could you please share your secret! Thank you

iOS import causing tons of errors?

I'm trying to set up a menu in my cocos2d game and whenever I import Game.h I end up with over 200 errors. It's a cocos2d app with box2d, I'm not sure why it's throwing all these errors though- the game was running perfectly before I swapped loading the Game scene for the MainMenu scene initially. The line of code I'm running is [[CCDirector sharedDirector] replaceScene: [Game node]]; The import of 'Game' causes the errors. Can anyone give me an idea about this? Some information that may be helpful... I originally created the project loading into Game.m but switched it to MainMenu and then import Game.h into MainMenu to access the object. ANY insight is appreciated! Thank you!

Loading NSData into a UIWebView

In my web browser, I am trying to load a UIWebView with NSData obtained from an NSURLConnection. When I try to load it into the UIWebView, instead of the site, it comes up with the HTML plain text. Here is my code: in viewDidLoad: NSURLRequest *request = [NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.msn.com"]]; [NSURLConnection connectionWithRequest: request delegate:self]; later in the code: -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ webdata = [NSMutableData dataWithData: data]; } -(void)connectionDidFinishLoading:(NSURLConnection *)connection{ [webview loadData:webdata MIMEType: @"text/html" textEncodingName: @"UTF-8" baseURL:nil]; }

Is a "CFRelease” needed if I am using CGImageSourceCreateWithData from a (__bridge)?

My question is very simple, I would like to know if the method "CGImageSourceCreateWithData" creates a new object copying the data I provide so that that I have to release it when I don't need it anymore, or if it just creates a reference to the data I already have so that if I release it I will lose this data (and possibly have bad access errors). The issue is related to using (__bridge CFDataRef) as the source data. Which let's me use Core Foundation objects as toll-free in ARC mode. Consider the following function (or method, not sure how it's called): - (void)saveImageWithData:(NSData*)jpeg andDictionary:(NSDictionary*)dicRef andName:(NSString*)name { [self setCapturedImageName:name]; CGImageSourceRef source ; // Notice here how I use __bridge source = CGImageSourceCreateWithData((__bridge CFDataRef)jpeg, NULL); CFStringRef UTI = CGImageSourceGetType(source); NSMutableData *dest_data = [NSMutableData data]; // And here I use