cocoa-touch

"scheduledTimerWithTimeInterval:" problem in cocos2d ?

hello, I am trying to developed a iPhone app by using cocos2d. I using "scheduledTimerWithTimeInterval" for calling a method that called a fixed time interval. But now time interval increases in gradually. for this reason the time is slow in gradually. here is my code: - (void) methodTime: (id) sender{ NSTimer *rat =[NST...

How return to the first view

This could be a dumb question, but men, I'm newbie on iPhone-sdk. I walk deep 5 views. Now, in the view #5 finish the workflow, but how return back to the first view? ...

Is there a decent OpenGL text drawing library for the iPhone SDK?

I'm trying to figure out a simple to draw some text in OpenGL. My research has shown its a fairly complex task. It involves creating (or generating at runtime) a font atlas texture, and then creating a quad for each letter with just the right placement and texture coordinates. I've heard some good things about freetype, but have found...

Can UIScrollView's deceleration rate be modified?

Since this question was originally asked, UIScrollView deceleration rate customization has been added via the decelerationRate property introduced in OS 3.0. I have a UIScrollView whose deceleration rate I'd like to change. To be clear, I'm talking about when you swipe your finger on a scroll view and the view continues to scroll (but...

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 <...

CALayer flickers when drawing a path

I am using a CALayer to display a path via drawLayer:inContext delegate method, which resides in the view controller of the view that the layer belongs to. Each time the user moves their finger on the screen the path is updated and the layer is redrawn. However, the drawing doesn't keep up with the touches: there is always a slight lag i...

navigationItem.title doesnt get refreshed

Hi, I have a RootViewController and a SubViewController. I traverse the views in either direction. The RootViewController is a UITableView SubClass. Depending upon the row selected I want to change the title of the subview using self.navigationItem.title = [chunks objectAtIndex:1]; It works when the subview is first time loaded. But whe...

UITextView with 3 lines automatically scrolls up when I enter <screen capture>

I have a UITextView that i use for typing some text (i have added it with Interface builder) i have made the height 3 font lines high (so in my case the frame height is 47) so i can have 3 lines of text what i want it to do is type until line3 and the go up if i goto line 4 but what it does is whenever i type enter it automatically goe...

How to access iPhone application directory and store image files there

I want to know whether I can access the directory where my application is installed. Also I want to create a sub directory in the same directory to store all the images I capture in my application. I further want to view the images using iPhone's default image viewer. Can this be done? ...

Using a struct with OCMock or Hamcrest

I'm hitting a road block and I'm wondering if the brilliant collective minds here can help. In ObjC CocoaTouch I'm trying to mock an object that takes struct parameters and returns a struct. OCMock is coughing up a hair-ball so I tried wrapping with a Hamcrest matcher. No die. The function/method I'm testing looks something like this: -...

Swapping UIImageView Images in a loop

I have a NSArray of UIImageViews that I want to loop over and quickly swap out an "on" and "off" state. I wrote the code to do so in a for loop instead a method that was called when the user tapped a UIButton ( the button's action ). Here's that loop: for(int i = 0; i < [Images count]; i++) { if( i > 0 ){ [self toggleImageViewOff:[...

rotate a UIView around its center but several times..

I'm trying to rotate some UIView around its center, so the simple code goes something like (in pseudocode): [UIView beginAnimations:@"crazyRotate" context:nil]; [UIView setAnimationDuration:1.0]; someview.transform = CGAffineTransformMakeRotate(angle); [UIView commitAnimations] now if I set angle to say M_PI/2 the thing rotates nicel...

iPhone getting the UIImageView back from NSArray

First of all many thanks for clicking into my question. I have a few UIImageView and a NSMutableArray at .h { IBOutlet UIImageView *img1; IBOutlet UIImageView *img2; IBOutlet UIImageView *img3; NSMutable Array *aImg; } @property(nonatomic, retian) IBOutlet UIImageView *img1; @property(nonatomic, retian) IBOutlet UIImag...

How to generate a new button by a button instanly without relaunching the application ?

i attempt to generate a new button item once i click on a button generator, it able to generate but only will show up on the screen after relaunch the application,but i want it be generated instantly and show up at the current view,any suggestion i know is something related to the viewDidLoad function,anyway pls help ...

NSUserDefaults on iPhone SDK not returning nil

I'm using NSUserDefaults for a Settings Application. This is a pristine copy and I have not at all added anything to the filesystem for this particular setting. I expect it to be nil, but on the contrary.. If I do something like the following: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ( [defaults valueForKey...

UIComboBox... Where is it?

So I'm pretty sure i already know the answer to this, but does the SDK include access to the combo box control used in mobile safari? It should be easy enough to build one... but I'm not looking to re-invent the wheel if I don't have to. ...

-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:] inquiry

I have a NIB file with a UIView, a couple of UIImageView's (including a logo) and a UITableView inset within the UIView below the logo where I allow users to input a username/password to login to my application. I also have a third arbitrary UITextField within a UITableViewCell below the username/password. The problem is, when it is clic...

How can I remove the Navigation bar from a Navigation Based iPhone app?

hi, I am novice iPhone developer . I am developing a Navigation based app for iPhone. I don't use the Interface Builder in my app. I want to remove the Navigation Bar from the application. How can I do this? ...

Simple metronome - Play an AIF every x number of milliseconds

I've had a look at the metronome sample given by Apple, however, the sample is too complicated and includes things not needed in my project. Is there a simple way to make a system sound play every x number of milliseconds? ...