objective-c

Typedef enum Objective-C

I have class Distance and typedef enum Unit, @interface Distance:NSObject{ double m_miles; } @property double m_miles; -(Distance *) initWithDistance: (double) value andUnit:(Unit) unit; @implementation Distance -(Distance *)initWithDistance: (double) value andUnit:(Unit) unit{ self = [super init]; if (self){ switch (unit...

How to write this without dot notation

Hi, Can someone please help me write the following, without using dot notation: self.bounds.size.width I have tried [[[self bounds] size] width], but this results in an error. Any ideas? ...

Get Following people on twitter with OAuth method? Objective C??

I create an object: SA_OAuthTwitterEngine *_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; then set the consumerKey and the consumerSecret... I can get the followers without problems by calling: [_engine getFollowersIncludingCurrentStatus:0]; Everything fine until now: I have to get the people that the user f...

iphone sdk: How do i add a button to a uitableviewCell?

hi, I'm trying to add a button to the uitableviewcell and i just can't get it to work any suggestions what i'm doing wrong?? checkButton = [UIButton buttonWithType:UIButtonTypeCustom]; [checkButton setFrame:CGRectMake(0, 0, 30, 30)]; [checkButton setBackgroundImage:[[UIImage imageNamed:@"checked.png"] stretchableImageWithLeftCapWidth:10...

View moves up when status bar hidden

I have an app where i have set the status bar to be hidden, in the plist. At first all looks fine, but then in one place in my app i use presentModalViewController to show another view. (this view is to show the twitter login screen) When i get out of the view (twitter login screen) and i get back in my app all my views move up. After...

Showing iPhone Keyboard Eats Large Memory Chunk

Hi all, I've seen several posts with people having this issue but no solutions. Basically clicking a UITextField to show the keyboard for the first time eats up ~4mb of memory (according to the activity monitor) and I never get that memory back (and I need it back :P). I know that UIKit will often take up a large chunk of memory for t...

Reduce Choppy Scrolling in Objective-C

I know this is kind of a vague question, but does anyone know how to get rid of choppy scrolling on a tableview? Thanks ...

Programming Floaty Motion

Anyone have a good idea for a method of achieving random floaty motion? Like, just general smooth drift in a constrained area. This is what I tried: var rangeX = 100; var rangeY = 100; var gravity = .001; $('.floating').each(function() { $(this).data('startX', $(this).position().left); $(this).data('startY', $(this).position()...

Load PDF from documents directory - iPhone

Instead of loading a PDF from the resources folder I would like to load it from the documents directory. I have been trying to do this for days but the CGPDFDocumentRef keeps returning NULL. Here is my code: // Get Documents Directory NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocu...

Copying a file to a directory that might not be writable by the application.

I am writing an application and I am at this point at the workflow: -File A doesn't exist? -Copy file B to file A -Error? -Copy file B to file A with higher privileges The problem is in the `Copy file B to file A with higher privileges' step. I am new to asking the admin for his/her password. I'd like a window similar to this, w...

Apple Memory Management Programming Guide / Hard example...

Hi, As many objc developers, I ended-up reading and reading again the Apple Memory Management Programming Guide, because that's the best way to understand retain/release/autorelease mechanisms. In this page, there is really an example I do not understand: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgm...

iphone: how to add checkboxes to a uitableviewcell?

Hi, I just can't seem figure out how to do this hopefully someone here can help me. In my tableview i want to add checkboxes to each cell and if you touch the checkbox a checkmark appears and a specific action is supposed to happen. but if you just touch the cell a different action is supposed to happen. Does anyone have an idea how to d...

Does @property (readonly, retain) have a meaning ?

XCode accepts it. But will retain be applied when I internally set the property (no setter outside since readonly but when I initialize the value in a class method) ? Regards, Apple92 ...

IPhone App Crashes on Device but Works on Iphone

I am a beginner at this :) I have an app which changes an image of a UIImageView when a button is pushed, each image is about 200 kb, when run in the simulator it runs ok, I can change the image many times with no problems. When run on my device (ipod touch) it loads ok, it sluggishly gets through about 4 images and then it crashes. Wh...

iPhone OS 3.2 equivalent of [CALayer contentsScale]?

Hey I'm trying to do the equivalent thing that the iOS 4.0 method CALayer::contentsScale does, which scales the size of the backing bitmap of the layer. Any way to do this in iOS 3.2, probably by setting the frame size and applying a transform? ...

XCode - nested functions are disabled !!!

I used to be able to do forEach loops in XCode, but after installing sdk 4 i get errors error: nested functions are disabled, use -fnested-functions to re-enable How can i enable nested functions It says "use -fnested-", but use is where? how? for (MyObject *obj : array) { } ...

Push messages on the iPhone

Ok, this is a hard one. I have three things: An iPhone app PHP-mySQL database on a server Google App Engine (?) The iPhone app is working fine storing data in the database. I'd like to notify some subscribers when the database changes (i.e. someone uploads something). I assume the app is running, so I just want the view up to date....

ImageIO: ERROR - MetadataLib.dylib not found

I'm getting an odd error in my console when running my app sometimes: ImageIO: ERROR - MetadataLib.dylib not found I'm not sure what this is related to, but I am running AdMobs ads. ...

App Crashed Because of Low Memory

How can I setup my app to handle low memory situations? What are best practices? Incident Identifier: 8BFDA96C-1019-4316-A278-CB86CC67172A CrashReporter Key: 1657e021ecba3a19c5ed9f0cff62947a426a2bc2 Hardware Model: iPhone3,1 OS Version: iPhone OS 4.1 (8B117) Date: 2010-09-28 00:00:12 -0700 ...

Building an application with a site's API

So I want to build an application in Objective C for a site that I use. Here is an example of their login API: Verify Credentials Allows authenticating user to check username/password. URL: http://myanimelist.net/api/account/verify_credentials.xml Formats: xml HTTP Method(s): GET Requires Authentication: true Response: Success: 200...