iphone

how we can show UIViewController and UIView by using cocos2d?

Hi, i am trying to build an iphone app by using cocos2d. but i have used four types of classes like bellow- @interface MenuScene : Scene {} @end @interface FlipView : UIImageView { CGPoint startTouchPosition; NSString *dirString; UIImageView *firstPieceView; UIImageView *secondPieceView; } @end @interface HelloCont...

how can inherite two classes at same layer?

Hi, i am new at the area of iphone. i am trying to build an iphone app by using cocos2d. i have used this type of classe like bellow- @interface MenuScene : Scene {} @end @interface FlipView : UIImageView { CGPoint startTouchPosition; NSString *dirString; UIImageView *firstPieceView; UIImageView *secondPieceView; }...

how i can set an image to another fixed position by touch option?

Hello, i am trying to build an iphone app by using cocos2d. and i would like to set an image to another fixed position from a fixed position by using touch as my wish(speedy, or slowly). i have got some code but it does not work properly. so freinds it will more helpful to me if i get any solution. ...

NSThread crashes on second call (iPhone)

i got an object and in that object i start my thread (for loading doing some url loading) when i have a return of my data i call a selector to perform on the main thread. works fine if i call it the first time , second time it crashes ( no specific error) [NSThread detachNewThreadSelector:@selector(doThread:) toTarget:self ...

How do I create a grid of icons like the iPhone home screen?

How should I go about creating a UI similar to the Springboard (home screen) on the iPhone? I'd like a grid of evenly spaced buttons with images where I can respond to the button tap. Is the UITable a good fit? Should I use a plain UIView and position the icons manually in DrawRect? Is there an alternative that will automatically evenly...

Does jquery work on the iphone´s safari?

I am working on a web-site where I use the slimbox2 plug-in (similar to lightbox) for jquery to generate photo enlargements. The plugin works in every browser I have tried except for Safari on the iPhone. It does work as expected on Safari for Windows but on the iphone there are two problems: The darkening of the rest of the page only...

iPhone: is it possible to alter data in an application's Documents folder?

Hello, I am building an iPhone game where I store the player's game data in the Documents folder of the application. The game data is serialized to disk using encodeWithCoder. Using this approach, am I at risk of malicious players altering the game data by hand? I know jail broken phones give you ssh access to your phone. So in theory, ...

CGContext - is there a way to reset the current context

In my iPhone project, I've got a UIView where I implement the drawRect method: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); Inside the method I do a whole bunch of drawing of lines, images and texts using this context. The problem is that when I re-use this view, the context does not get re...

Lossy compressed format to raw PCM on iPhone

I want to start with an audio file of a modest filesize, and finish with an array of unsigned chars that can be loaded into OpenAL with alBufferData. My trouble is the steps that happen in the middle. I thought AAC would be the way to go, but according to Apple representative Rincewind (circa 12/08): Currently hardware assisted comp...

Touches getting Buffered

Hi In my game When i am applying touches on my subView very fast it just buffered all the touches and detect it after some time. And it apply all the touches result at a time. Means it takes noticeable delay to detect my touches on iphone so please can any one tell me how to solve this problem. So it will detect my touch when i am doing...

Can you make the settings in Settings.bundle default even if you don't open the Settings App

I have an iPhone application with a settings.bundle that handles various settings for my application. I can set default values in my root.plist file (using the DefaultValue property), but these only get used the first time the user opens the settings app. Is there any way to get these values written out when your application installs? I ...

Is there a way to test a web site on the iPhone without an iPhone?

I want to test a website to see how it works with the iPhone but I don't own an iPhone or an iPod touch. Is there a way I can test how the site works on them without owning one? What I'm really after is fixing how Stackoverflow's WMD markdown editor works on the iPhone. I hear that the hyperlink and image prompts are created too high....

What happens to the root view in UINavigationViewController when you push on a new view?

Specifically, what am I supposed to do with the view that is now hidden after pushing on a new view controller? In my situation I have a view with animations going on, that continue to execute after the view is off screen. Is there some accepted convention? Do I remove the View Controller and View from memory? Does Cocoa Touch have a co...

How do I generate random numbers on the iPhone?

What is the best way to generate random numbers using Objective C on the iPhone? If I use (int)((double) rand() / ((double)(RAND_MAX) + (double) 1) * 5.0) to generate a number from 0 to 4, every time I start the program on the iPhone it generates the same numbers to start off with. ...

how to pass a variable to a UIButton action

I want to pass a variable to a UIButton action, for example NSString *string=@"one"; [downbutton addTarget:self action:@selector(action1:string) forControlEvents:UIControlEventTouchUpInside]; and my action function is like -(void) action1:(NSString *)string{ } However, it returns a syntax error. Can someone show me how to pass...

What's the best way to save User data (email+password) into your app?

I have an application where the user can log in but i don't want the user to enter his credentials every time he wants to use the application. 1 time would be sufficient but how(and whats the best way) to save 2 strings that i can revive by starting the application. ...

Checking to see if an optional protocol method has been implemented

Hey there, Does anyone know the best way to check to see if an optional protocol method has been implemented. I tried this: if ([self.delegate respondsToSelector:@selector(optionalProtocolMethod:)] ) where delegate is: id<MyProtocol> delegate; However - I get an error saying that the function respondsToSelector is not found in th...

objective-c: determining if a regex matches a string

What's wrong with the following code? -(IBAction)numFieldDoneEditing{ NSPredicate * regexTest = [NSPredicate predicateWithFormat: @"SELF MATCHES '^\\d*\\.\\d{2}$'"]; NSString *text = [[NSString alloc] initWithFormat: @"%@", numberField.text]; if ([regexTest evaluateWithObject: text] == YES) { //do somet...

How do I enumerate and load resources in an iPhone app?

I'm trying to populate an NSArray with a collection of images in Resources. However, for maximum flexibility, I'm trying to avoid hard-coding the filenames or even how many files there are. Normally, I'd do something like this example from the sample code at apple: kNumImages = 5; //or whatever NSMutableArray *images; for (i = 1; i <...

Will an iPhone app's applicationWillResignActive: method run on incoming call if the phone is already in standby mode?

I understand that if an iPhone app is interrupted (e.g., incoming call, user hits the "Sleep" button, etc.) its applicationWillResignActive: method is called. But is this method also called if the phone is already in sleep mode? For example, if the phone goes into standby due to inactivity (or the user does it manually via the sleep but...