iphone

iPhone dev - NSTimer accuracy for time instead of recalculating?

I have a little project that is a timer that counts down 'til midnight, and I was wondering If I should leave it as it is, calculating the time until midnight each second (inside NSTimer method that gets called every 1 second): NSDate *now = [[NSDate alloc] init]; NSDateComponents *dateComponents = [[self gregorian] components: (NS...

AVAudioPlayer turns off iPod - how to work around?

I use AVAudioPlayer to play sounds in my app, but it turns off the iPod when a sound plays. Is there a way to prevent this? I don't want to use System Sounds because I can't control their volume. Thanks for your help. ...

If a method is called at the exact same time twice, how to only execute it once?

We have a method in the iPhone SDK that is a delegate method. Problem is, the OS calls this method twice at the exact same time. This method does some heavy lifting so I don't want to execute the logic twice. What is a good way to detect this and prevent one of the two from running? Forgot to mention that, it is called from different ...

UITextView - text shifts out of view when editing

I have a tableHeaderView with a UITextView in it. The view loads from a nib. The UITextView does not have any scrolling turned on. The reason I am using it is simply that it wraps text over two lines. I gave it just enough room to fit two lines of text. The data that I prepopulate works just fine, and is aligned in the center vertic...

Custom keyboard clear button

In my application i create a custom Numberpad .How can i delete whole contents of the textfield on continuos tap on the clear button. Any idea? ...

iPhone :Change Application Name and icon

hi all, i am new to iPhone programming. i create a application in Xcode. I want to change the application name and icon.However i can change the application name (which is appeared below the icon of application in iPhone) and icon from plist. i want to ask that whether there are any other method or trick from which i can change the icon...

How do i subclass a UIView?

This may seem like a stupid question, but i can't quite remember how to subclass a UIView. Can anyone point me in the right direction? ...

Tableview scrolling bounces back and hides the bottom cells.

I have a view that is shown under a navigation controller. The view contains one subview at the top portion and a table view at the bottom. The table might have rows that extend beyond the visible height based on data. When I have rows that are below the last visible row, if I scroll the view up, it bounces back, it does not stay there. ...

Is it possible to make a UIImage with a smaller memory footprint?

I have a UIImage that is being filled with the image coming from the iPhone camera. As the image has 2048x1536 pixels, it consumes a big chunk of memory. I hope this image is 24 bits, rather than 32 bits, but I am not sure. So this is the first question. Is the image coming from the iPhone camera 24 or 32 bits? The second question is...

How can I define my custom collate in Sqlite (in Objective-C) (for iPhone)

I need to define an arbitrary comparison method for sqlite in code. I need to be able to search for "e" and find both "e" and "é" (this is an example and the actual characters are in Persian). any help appreciated. ...

Preserving content-type when posting a file from iPhone to Rails

I am posting a .zip file from the iPhone to a Rails server using an NSURLRequest. The problem is that the content-type of the zip file is lost in-transit. When I upload the same zip file from a web-browser to Rails, the content-type is preserved. This leads me to believe it's related to the way I'm sending it from the iPhone. Does anyone...

iPhone: Change application Bundle files

hi all, in my application bundle, there are a XML file. i want to change this XML with other XMl file which have same name (without open Xcode). so i want to ask that whether there are any problem arise when i run this application in iPhone ...

Releasing a CocosNode and adding its children to Layer in Cocos2d

I'm working on a Tetris clone in Cocos2d for the iPhone and I'm using a Block class of Sprites for the individual blocks and a Tetromino CocosNode class that the user controls in order to move the Blocks. All of these Blocks move around in a 20 by 10 grid of empty Blocks on the GameBoardLayer. When the block finishes falling, I'd like ...

How to add new entity to main table's view from pop up view in iPhone?

Hi, everyone. I am working on an iPhone application but something strange happen. I think I can ask you for advice. I implemented a TableView and a custom view as a create new object form. I make the custom view slide up when user tab 'Add' button in the tool bar in TableView like the code below: - (void)slide_up_form:(id)sender { ...

Table View Cell value from iphone

Hi all, I just want to get the value of a cell in the table view when i tap on it.. can any one help me in this.? Thanks in Advance Shibin Moideen - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { appDelegate.courseName=[appDelegate.courses objectAtIndex:indexPath]; NSLog(@"%@",appD...

Link with File's Owner problem

I created a nib file "WebViewController.xib". And try to link the UIView with File's Owner. But it doesn't work. Also sometimes with other nib files, I deleted a connection from View Connections->Referencing Outlet, then tried to connect again, but it can't link with File's Owner anymore. How to fix this? Thank you. ...

Problem with editing style when inserting a new row at top of UITableView as part of entering Edit mode

I have a UITableView with a single section and 'n' rows (populated from an NSMutableArray, myTableArray). When entering Edit mode, I would like to achieve the following: setup the "n" rows to have the UITableViewCellEditingStyleDelete editing style insert a new row, above the original 'n', and set it up to have the UITableViewCellEditi...

How to change orientation to landscape on button event

How to change orientation to landscape on button event ...

iPhone performance measurement for code that only runs once?

Hi, I'd like to measure the performance of code on the iPhone that runs only once, so Instrument's CPU sampler tool is of limited use, because it needs many iterations to collect enough samples. Is there a tool that I can use that times each function on each invocation? That does call tracing instead of statistical sampling? Regards, ...

iPhone App Quits on Launch Without Crash Log

My application runs fine on 3.0 devices and on 3.1 devices when launched via Xcode, but crashes on startup when run on a 3.1 device when installed via iTunes. It leaves no crash log behind, but puts this into the console: Thu Oct 1 19:33:36 unknown mobile_installationd[329] <Error>: 00808e00 install_embedded_profile: Skipping the insta...