Tag: objective c

how can I use animation in cocos2d?

I am trying to develop a Roulette game for iPhone. How can I animation (spin) the Roulette board?

iPhone development: pointer being freed was not allocated

i got this message from the debugger: Pixture(1257,0xa0610500) malloc: *** error for object 0x21a8000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug so i did a bit of tracing and got: (gdb) shell malloc_history 1257 0x21a8000 ALLOC 0x2196a00-0x21a89ff [size=73728]: thread_a0610500 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal […]

Unable to add UITextField to UIAlertView on iOS7…works in iOS 6

The code below works on iOS6 (and before) but the UITextField does not display in iOS7…any ideas on how to get a UITextField to display in an UIAlterView in iOS7? UIAlertView* dialog = [[UIAlertView alloc] init]; [dialog setDelegate:self]; [dialog setTitle:@”Enter ESC Score”]; [dialog setMessage:@” “]; [dialog addButtonWithTitle:@”Cancel”]; [dialog addButtonWithTitle:@”OK”]; dialog.tag = 5; nameField = [[UITextField […]

Run AppleScript from Cocoa Application

Is it possible to run an AppleScript code inside an Cocoa Application? I’ve tried NSAppleScript class, but no success. Also, does Apple allow this?

Checking Objective-C block type?

This is primarily a curiosity, I’m not really sure what’s the practical use of this but here goes. Since blocks are also Objective-C objects, is it possible to check their type? That is, does it respond to the isKindOfClass: message and how to use that message with respect to blocks? My naive thought that it’s […]

UITableView reload data

i’m making a navigation based application for iphone. one of my view controllers looks like this: @interface NewComputerViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> so i’m using a UITableView to show data. when the view loads, I use a button in the top navigation bar to run a function loadStuff load some stuff in a Dictionary. My […]

Static string variable in Objective C on iphone

How to create & access static string in iPhone (objective c)? I declare static NSString *str = @”OldValue” in class A. If i assign some value to this in class B as str = @”NewValue”. This value persists for all methods in class B. But if I access it in class C (after assignment in […]

Crossplatform iPhone / Android code sharing

Simply put: What is the most effective way to share / reuse code between iPhone and Android builds? The two most common scenarios I think would be: Blank slate new project, knowing ahead of time there is a large chunk of reusable logic that needs to run on each device. Existing iPhone code base, porting […]

UIImage to base64 String Encoding

How to convert UIimage to base64 encoded string? I couldn’t find any examples or codes with detailed regarding.

How can I break out of two nested for loops in Objective-C?

I have two for loops nested like this: for(…) { for(…) { } } I know that there is a break statement. But I am confused about if it breaks both loops or just the one in which it was called? I need to break both ones as soon as I see that it doesn’t […]