objective-c

Subclass NSCache - App Singleton

I am writing an iPhone app and I want to create a NSCache singleton. I am having trouble, here's the code that I have: MyAppCache.h: #import <Foundation/Foundation.h> @interface MyAppCache : NSCache {} + (MyAppCache *) sharedCache; @end MyAppCache.m: #import "SpotmoCache.h" static MyAppCache *sharedMyAppCache = nil; @implement...

Nested UIViewController does not respond to device rotation.

Hello, I'm developing an app using a fork of LeavesViewController that changes to a two-page orientation when the device turns to landscape. When using the Leaves controller alone, everything works fine. When using the Leaves controller inside the view of my main UIViewController, it never gets any of the device rotation messages (how...

Objective-C: "warning: property 'owner' type does not match protocol 'PieceModel' property type"

I'm getting this warning. What I'm trying to do is have a family of classes and a parallel family of protocols. The class Piece has a declaration like this: @interface Piece : NSManagedObject <PieceModel> { } ... @property (nonatomic, retain) Player *owner; ... @end PieceModel has this @protocol PieceModel <NSObject> ... @prope...

Source code not showing while debugging in XCode, only assembly

Is there any reason why XCode would fail to show the source code for a specific file while debugging? I have a breakpoint in the file which xcode hits correctly, but all I see is assembly. More annoyingly, this problem only shows up for one specific file (a regular .m file), but no other file. None of my co-workers have this problem, so ...

Properly using CoreText

Hey there, I'm having difficulties with adopting the UIKeyInput Protocol with Core Text. I currently have most of it done as posted in the source code, however for some reason it glitches as it types, with incorrect font height for the first letter of each new line, which doesn't really make much sense since it's just drawing whatever is...

How do I convert a Java Hashtable to an NSDictionary (obj-C)?

At the server end (GAE), I've got a java Hashtable. At the client end (iPhone), I'm trying to create an NSDictionary. myHashTable.toString() gets me something that looks darned-close-to-but-not-quite-the-same-as [myDictionary description]. If they were the same, I could write the string to a file and do: NSDictionary *dict = [NSDicti...

How to show No Results screen on UISearchDisplayController?

How can I manually show No Results on a UISearchDisplayController? ...

Testing Classes in Objective-C

I'm trying to find a way to test my objective-c classes like i test my java classes. Whenever i build a java class I just drop a main() method at the bottom of my class and tell eclipse to compile/run the class I'm working with. However, in objective-c I'm not allowed to do this. I have been reading around the web and have heard a lot a...

TextView's scrollbar style

The Scroll Indicator Style only has 3 settings, Default, White and Black. I want it to be Orange, how do I change the colour? ...

How do I dynamically create an NSString object based on the number of objects in an array?

Members of my favorite forum, I am stuck with a simple problem (chalk it up to the fact that I am fairly new)... I am using an action sheet. I don't know how many buttons to display, so I decided to set the action sheet delegate to display FOUR buttons in total using string variables, knowing that if I only need to display 2, I can set...

How do you make an Iphone beep

What code allows me to produce a standard beep sound on the iPhone? ...

iPad - how should I distribute offline web content for use by a UIWebView in application?

I'm building an application that needs to download web content for offline viewing on an iPad. At present I'm loading some web content from the web for test purposes and displaying this with a UIWebView. Implementing that was simple enough. Now I need to make some modifications to support offline content. Eventually that offline content ...

Add a subview without waiting until the next frame.

I'm trying to create a loading view that is displayed when code is being called. Right now when I call to add a subview it isn't added until the rest of the method has been run through. For example, - (void)loadFight:(NSString*)levelName { [self createLoadingView]; sumoController = [[sumoViewController alloc] initWithNibName:@"s...

iOS: How to make a secure HTTPS connection to pass credentials?

I am creating my first iPad app. I have a web application that I would like to authenticate against and pull data from in a RESTful way. If you open up the URL in the browser (https://myapp.com/auth/login), you will get a form to enter your username and password. I was thinking I could set the login credentials in the post data of the r...

Sample code for iAd in iOS 4

I'm looking for code samples and tutorials for integrating iAd in iOS 4. What are some good resources for this? ...

Using non-copyable object as key for NSMutableDictionary?

I tried to figure out this code referencing: http://stackoverflow.com/questions/1187112/cocoa-dictionary-with-enum-keys + (NSValue*)valueWithReference:(id)target { return [NSValue valueWithBytes:&target objCType:@encode(id*)]; } And, [table setObject:anObject forKey:[NSValue valueWithReference:keyObject]]; But it feels somethin...

Generating random numbers with ARM Assembly

hi , i want to generate random number to use it in my iphone project by Inlining in my objective-c code some assembly , is this possible with arm-assembly ?! Thank you to help .. ...

UITableView data reloading problem.

I am working with a UITableViewController subclass, that is supposed to go from a "Login Table" (a table containing a UITextField for the username and for the password and a Start Session cell), when the user touches the "Start Session" cell the UITableViewController should be reloaded and just show one cell with a "Log Out" label. The ...

navigation controller

hello everyone. in my project.we use pushview controller over one another...will u please giv eme e example for this ...

How to write the source code for TailGame in iphone sdk using objective-c?

Hi................ I am newely worked on iphone sdk ....... So I want to the BackGround Code for Tail Game in iphone Sdk.......please send me the response?please requsted....... ...