objective-c

How do I take an image off a website and save it to NSDocumentDirectory

Hi. I am trying to make a app to take photos off of a website, and save them to the NSDocumentDirectory for later usage. So far I have failed in my attempts, and am wondering how to do it. Not much more explanation is needed, but here are a few of my (failed) tries: One: NSString *path = @"http://miniwidgit.webs.com/TabRight2.png"; NSF...

Reloading TTableView after DataSource items are added

Hi, This is the code of my initializer: if (self = [super init]) { self.title = @"Posts"; self.variableHeightRows = YES; //XLog(""); PostsDataSource *dataSource = [[[PostsDataSource alloc] init] autorelease]; [dataSource.delegates addObject:self]; [dataSource load:TTURLRequestCachePolicyMemory nextPage:NO]; ...

Cocoa memory management, why does my app keep using more?

I made a xfire client for mac (called BlackFire -> http://www.macxfire.com) and it keeps using more and more ram over time, even when not doing that much. I have run the app with instruments::leaks and it doesn't show any leaks at all (when it did i fixed them quickly). Somehow it still keeps using more ram, like it is supposed to or so...

How to replace the custom animation for a CALayer appearing

I have a CALayer that I want to change the custom animation for it appearing on screen. I have created a delegate so that I can catch the method: - (id < CAAction >)actionForLayer:(CALayer *)layer forKey:(NSString *)key And I check for the key to be equal to kCAOnOrderIn, however, the layer hasn't been told what it's bounds will be ye...

iPhone ABPeoplePickerNavigationController - How to select two single entries of two different multivalue properties of a person from Addressbook

Hello everyone! I'm near desperation as I search for a solution for weeks now. The Problem is simple: Via the ABPeoplePickerNavigationController (as a ModalView), a person should be selected. Then only (e.g.) the Mail addresses should be shown and the user should select one. After selection of a Mail address just the (e.g.) phone nu...

TouchesBegan and TouchesEnded with Multitouch issue

I'm using TouchesBegan TouchesMoved with Multitouch. I have a manual implementation of what is essentially a button. I bounds test on the point of TouchesBegan to set the button as down and the same for TouchesEnded to reset it. The problem is if the user moves the finger out of the bounds of the button before lifting then the Touches...

key-value coding and to-many relationships

Hi there, I'm a bit confused with key value coding and to-many relationships. I've read that when having such relationship I should use [object mutableArrayValueForKey:@"key"]; to retrieve the mutable array that holds the objects in that ordered relationship. What I don't understand is what's the difference between mutableArrayValueFor...

CoreData and NSXMLParser

Hi Stackoverflow friends, I am parsing an XML file of the network using NSXMLParser after I got the Data from NSURLConnection. The XML has many "items" and each item contains 1 category. In the CoreData module i have an Item entity with a relationship to one Category. While parsing the XML file and hitting the message parser:didStartEl...

sizeWithFont doesn't give correct height for UITextView if there is a long string in the text being wrapped

Is there a way to get the correct size of an NSString using: - (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode that doesnt get thrown off by 2 or 3 hundred character strings. At the moment if I try to use this method on these long strings it incorrectly calculates them and I end...

Accessing sprites in a NSMutableArray returns an error - simple question

Why doesn't this work? // spriteArray is an NSMutableArray int spriteWidth = [spriteArray objectAtIndex:0].contentSize.width; I get the error: Request for memeber 'contentSize' in something not a structure or union If I change the code: CCSprite *tempSprite = [spriteArray objectAtIndex:0]; int spriteWidth = tempSprite.contentSize.w...

Can you see a #defined item in a compiled binary?

I'm looking to "hide" some information in my code, and I'm not sure if this will do the trick or not. I know string literals are easily found and viewed in a compiled app, but what about integers? Lets say I define a number #define kHiddenNumber 1234567 and then in my code reference it using kHiddenNumber as an integer. Would that be vis...

CAScrollLayer doesn't scroll!

Maybe it's because it's late. Whatever the reason I can't figure out why I'm having trouble with a simple CSScrollLayer example I'm trying. I add a 50 pixel Eclipse icon to a view based project and in my initialize method (called from initWithNibName:bundle:) I have this: -(void) initialize { CAScrollLayer *scrollLayer = [CAScrollLaye...

download a web page with objective-c

How can i download the html content of a webpage given an url? using objective c.. ...

Objective-C class -> string like: [NSArray className] -> @"NSArray"

I am trying to get a string name of a class from the class object itself. // For instance [NSArray className]; // @"NSArray" I have found object_getClassName(id obj) but that requires an instance be passed to it, and in my case that is needless work. So how can I get a string from a class object, and not an instance? ...

how to end user session (log out) in twitter using objective C

Hi friends, I have integrated twitter in my app. but I am not able to log out the session of the user. For logging I am using http://%@@twitter.com/statuses/update.xml and passing the username and pswd in the url. Inside body i pass the string that needs to be updated and its working fine. Now For log out they have an request called ...

How would I develop something like DeskLock from Deskshade?

Hi everyone! Sorry to be a nuisance, but I have yet ANOTHER question. How would I do something like DeskLock from macrabbit's Deskshade app? I've made the little window and that's as far as I've come. I know how to "lock" the screen in 10.6 with PresentationOptions, but I don't want to risk it because last time it wouldn't let me back in...

adjust the speed of the playback of a video

Hi is there a way to adjust the speed of the playback of a video while playing in Objective C for the iPhone/iPod touch? ...

NSThread calling threading delegate function

I am using a framework to get information from the network. The problem is the function I'm using to get the information is threaded (ie. it gives information through a didFinish selector, not the actual function as the return value). I want to create a separate NSThread that uses this threaded function. The problem is if I detach a thr...

Parsing XML on iPhone created in PHP

Hello, i'm trying to parse a xml string with NSXMLParser which i created in PHP. My PHP sript is: $doc = new DomDocument('1.0'); //$doc->preserveWhiteSpace=false; $root = $doc->createElement("root"); $root = $doc->appendChild($root); $child = $doc->createElement("child"); $child = $root->appendChild($child); $value = $doc->createTextNo...

How can I test my new app on my real iPhone?

I have jailbroken iPhone. I want to test my applications on my real iPhone whithout paying $90 . How can I do this? ...