objective-c

Storing image in plist

How can we store images in plist file. Where is this plist file stored? Can anyone give me an example? Answers will be greatly appreciated! ...

Objective C / iPhone comparing 2 CLLocations /GPS coordinates help

Ok , so thanks to Claus Broch I made some progress with comparing two GPS locations. I need to be able to say "IF currentlocation IS EQUAL TO (any GPS position from a list ) THEN do something My code at the moment is : CLLocationCoordinate2D bonusOne; bonusOne.latitude = 37.331689; bonusOne.longitude = -122.030731; Which is th...

How to use the default background image for iPhone UIView?

How can I use the default background image for a UIView? ...

error: 'NSUnarchiver' undeclared (first use in this function)

I have just tried using the NSArchiver but for some reason I am getting this error. I have downloaded a sample project and get the same error too. Could it be something wrong with my installation?! Thanks ...

Why my message become some monster char?

NSString *msg = [[NSString alloc]initWithFormat:@"Hello %s, What do you do", (self.isUser ? @"User" : @"Guest")]; NSLog(msg); When I print the msg, it show that this is "†¶·»,", instead of user/guest, what's happen? ...

How to store enum values in a NSMutableArray

My problem is since an enum in objective-c essentially is an int value, I am not able to store it in a NSMutableArray. Apparently NSMutableArray won't take any c-data types like an int. Is there any common way to achieve this ? typedef enum { green, blue, red } MyColors; NSMutableArray *list = [[NSMutableArray alloc] i...

Iphone: UIWebview and double taps

I would like to trap a double tap event in a UIWebView. I have derived a class from UIWebController. When I double tap it seams that the UIWebController itself is responding to my double taps instead of my class. The weird thing is that when I change the inheritance to inherit from UIView everything works just fine. Below are snippets f...

What's the fastest way to determine if a file adheres to a particular class's NSCoding implementation?

Given: An application that accesses a directory of files: some plain text, some binary files that adhere to a particular NSCoding implementation, and perhaps other binary files it simply doesn't understand how to process. I want to: Be able to figure out which of the files in that directory adhere to my NSCoding class, and I'd prefer no...

How are declared private ivars different from synthesized ivars?

I know that the modern Objective-C runtime can synthesize ivars. I thought that synthesized ivars behaved exactly like declared ivars that are marked @private, but they don't. As a result, come code compiles only under the modern runtime that I expected would work on either. For example, a superclass: @interface A : NSObject { #if !_...

Bypass system sound setting objective c

Hi. I have an app that Is supposed to play a AudioServicesPlayAlertSound(); but I've noticed on the iPod touch 1G, the sound will only play if the system sound setting is set to speaker or both. Is there a way to bypass this setting, because I know it works when the setting is not set to headphones. Also, if it is not possible, is there ...

How to edit Selection indicator in UIPicker?

Ad you can see, there is a example. The UI picker's Selection indicator. How can I do the similar thing on my Apps? ...

Simple way to show the 'Copy' popup on UITableViewCells like the address book App

Is there a simple way for subclasses of UITableViewCell to show the 'Copy' UIMenuController popup like in the Address book app (see screenshot), after the selection is held for a while? ...

NSRangeException Issue

Hi, I am writing a Core Data-based iPhone app and I am new to Objective-C. I have a bug that I am really struggling to nail. The iPhone simulator keeps crashing with the following error message: 2010-03-21 17:37:40.583 Patients[3689:207] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray insertOb...

Loading an OverlayView from XIB -vs- programmatically for use with UIImagePickerController

I am currently making a camera app for iPhone and I have a strange phenomenon that I can't figure out. I would appreciate some help understanding. When recreating an overlay view for passing to UIImagePickerController, I have been successfully been able to create the view programmatically. What I haven't been able to do is create the vi...

How to test a class that makes HTTP request and parse the response data in Obj-C?

I Have a Class that needs to make an HTTP request to a server in order to get some information. For example: - (NSUInteger)newsCount { NSHTTPURLResponse *response; NSError *error; NSURLRequest *request = ISKBuildRequestWithURL(ISKDesktopURL, ISKGet, cookie, nil, nil); NSData *data = [NSURLConnection sendSynchronousReques...

Can not read and save a number from/into an .plist

Hello, I created a property list with the name propertys.plist. Then I wrote this: NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"speicherung.plist"]; NSMutableArray *plistData = [[NSMutableArray arrayWithContentsOfFile:finalPath] retain]; int a = [[plistData objectAtInd...

How do I create a view that persists through all other views and controllers?

I was wondering how I would go about creating a view that persists through all the over views and controllers in the application. Similarly to how Soundcloud does it with their music player in their iPhone app (See pic). No matter where you go in the application the music player view stays at the top below the toolbar. ...

On iPhone Objective C, How do you catch the event of a row in a table being selected?

I have a data table filled with text in each table row. How do I attach to the event for the row being selected and know which row was selected? ...

Nested factory methods in Objective-C

What's the best way to handle memory management with nested factory methods, such as in the following example? @interface MyClass : NSObject { int _arg; } + (MyClass *) SpecialCase1; + (MyClass *) SpecialCase2; + (MyClass *) myClassWithArg:(int)arg; - (id) initWithArg:(int)arg; @property (nonatomic, assign) int arg; @end @implem...

Require user to go through login screen before giving access to iPhone app?

On iPhone, how do I show a login screen to get username and password before giving access to iPhone app? Also, does the iPhone store a cookie to the secure website like a web browser? I was thinking of giving users to my website a long API key to store in the settings of their iPhone instead of asking them to login with a username/pass...