objective-c

How to create a array of buttons Object?

I want to create 10 buttons using an array. How to create it? I am using array = [[[NSArray alloc] initWithObjects:button1, button2] retain]; But It tells Missing Sentinel in Function Call. Where, I am wrong? ...

When is using the native language for mobile phones a better choice then using Phonegap/Titanium/Rhomobile

Greetings all Currently looking at some possible work in the mobile field and one question that I havent (yet) found an answer to is why developers that wish to market their apps to the greatest range of mobile phones would choose to code in the phones native lnauge over cross platform techs such as phonegap, titanium, rhomobile, and ot...

Accessing XHR (XMLHTTPRequest) content when using WebKit in Objective C.

I've been trying for hours with all the different delegate methods to access the content of an XHR request that is automatically requested when a page is loaded. I have used the following which has shown that WebKit is seeing the request in the first place (as the URL that's displayed is the correct one). - (void)webView:(WebView *)sen...

Make UIView resign first responder when tapped outside of view

Is there any way to make a UIView resign its first responder status when the user taps outside of the view bounds? ...

simulate java enum objective-c

Hi all, in java an enum can be declared like this enum MyEnum { ONE("descr for one"), TWO("descr for two"); private String descr; MyEnum(String descr) { this.descr=descr; } public String getDescr() {return this.descr;} } therefore we can always call myEnumInstance.getDescr() for getting enum description. It is pos...

NSKeyedUnarchiver does not call initWithCoder

Hello All, I've used the following example: http://stackoverflow.com/questions/2670815/game-state-singleton-cocos2d-initwithencoder-always-returns-null Instead of using a file, I use an NSData object i am getting from NSUserDefaults. It is not null, but rather have data in it that I believe is the correctly encoded data and for some ...

Creating Menus and Keyboards with Cocos2d

Hi all Im just creating a menu for an iphone app using cocos2d CCMenuItem. Now i havent been using cocos2d that long so i may be doing this completely arse ways so hopefully someone can point me in the right direction. CCMenuItem *mainMenuItem = [CCMenuItemImage itemFromNormalImage:@"Main Menu Up.png" selectedImage:@"Main Menu Down.png"...

iPhone and SQLite: How to handle the database connection with multiple classes?

Hi, I have some doubts about SQLite... My app uses only one table (encapsulated in a data logic class) to store small data, the connection is opened in didFinishLaunchingWithOptions and finalized in applicationWillTerminate (yes, I know that in iOS4 applicationWillTerminate is only called by iSO if necessary, but I write on database at e...

How do you rotate a UIImage 360˚

How do you rotate a UIImage 360˚ without open GL ES ...

"Cannot find interface declaration error..." after @class

Hey all, I've run into an Objective-C problem that doesn't seem to make any sense to me. I am a relatively well-versed ObjC programmer and understand the whole "forward declaration" concept, but this one has me scratching my head. So here's the deal: ClassA is a class in my Xcode project that is project-only. ClassB is a subclass of ...

iphone instruments tells about memory leak in NSMutableArray *bookDicts = [NSMutableArray arrayWithContentsOfFile:documentsDirectory];

Hi Can anyone tell me what I am doing wrong in the following few lines? NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *documentsDirectory = [paths objectAtIndex:0]; documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"Immobilien.plist"]; ...

How to add a badge to a UITabBar that is customizable?

I am adding a badge to my UITabBarController's UITabBar as such: UITabBarItem *tbi = (UITabBarItem *)[stTabBarController.tabBar.items objectAtIndex:1]; tbi.badgeValue = @"2"; However, my UITabBarController is customizeable, so the index may change. How can I make sure the badge gets applied to the correct UITabBarItem? ...

how do I catch a NSRangeException?

I want my app to continue gracefully when the online server messes up. I tried to wrap the dangerous line in a @try block. Yet it is still crashing like so: the method: + (NSArray *)findAllFor:(NSObject *)ratable { NSString *ratingsPath = [NSString stringWithFormat:@"%@%@/%@/%@%@", [self getRemoteSite], [ratable getRemo...

NSWindow titlebar turns white when resizeing

Hi, I'm programatically resizing my NSWindow containing an NSOpenGLView. The window resizes, the NSOpenGLView is handling the resizing fine, but the titlebar of the NSWindow turns completely white. However the buttons (minimize,...) can be clicked, also you can not see them. Resizing occurs using the following code in the windows con...

Programmatically discover identity of first responder

I want a UITextField to be sent the resignFirstResponder message if it is being edited and a user touches elsewhere on the screen. Since there are several text fields I need a way to programmatically determine which one is the first responder to send it the message. How can I do this? Is there some sort of global first responder object? ...

Convert char to int to NSString

I am writing some code to allow users to answer multiple choice questions. So I have an NSArray of values [@"value1", @"value2", ..] I want to display them as: A) value1 B) value2 The code I have is for(int i = i; i < [values count]; i = i+1) { NSString *displayValue = [[NSString alloc] initWithString:<NEED HELP HERE>]; displayValue =...

What is the difference between building an iphone app in Xcode and reopening it on the iphone? Wh

My application brings up a different view each time it is built in Xcode. This is exactly what I want it to do. However, if I simply press the back to menu button in the simulator and then reopen it the view does not change. I am changing the view by overwriting the viewDidLoad function in a Custom View Controller. Why is it that ViewDid...

UINavigationController inside a UITabBarController with several views in the navigation controller

I've got a UINavigationController that has a UITableViewController as it's root view. The UINavigationController is inside a UITabBarController. In the UITableViewController (*viewOne), if I click a cell a the following code runs UIViewController *newView = [[UIViewController alloc] initWithNibName:@"newView" bundle:nil]; [self.navig...

Xcode warning: "May not respond to"

I have a few methods for initialization of different stuff in my class implementation. However, when I invoke these methods by using [self 'methodName'], the Xcode compiler gives me a warning that I could not get rid of. 'className' may not respond to 'methodName' For example, warning: 'NextJackpotViewController' may not respond to -...

objective-c autorelease

Im new to obj-c and have trouble understanding the function autorelease. could someone explain to me when i should use it? and how is it different than release. also do I need to reset the autorelease pool? how? and when? ...