objective-c

How to truncate the content of back button in UINavigationController?

Hi Guys, I need to truncate the string content of back button of navigation controller. Let me explain clearly. I have large title in First view controller, same name is appearing in the next view controller while navigating in a back button. So much space is occupied by back button, I could not able to set the title clearly in next vi...

Instruments bug or coding error?

A quick question from a beginner. I'm doing an App for the iPhone and get the following message in Instruments when looking for leaks. Is there anything I have done wrong or is this just how it is? I had some memory leaks in my own library, but I took care of those. But how to solve this? Thanks ...

How to calculate the y-pixels of someones weight on a graph? (math+programming question)

I'm not that smart like some of you geniuses. I need some help from a math whiz. My app draws a graph of the users weight over time. I need a surefire way to always get the right pixel position to draw the weight point at for a given weight. For example, say I want to plot the weight 80.0(kg) on the graph when the range of weights is ...

How to add two textField value

hi .. i want to take two textfields values and add the values and show them into another textField. How to do this programatically. Thanks in advance ...

iPhone SKD make the iPod controller appear

Hi all, It's been a while I'm consulting stackoverflow, but this time I didn't find any answer :( My question is quite simple :) On an iPhone/iPod touch, play music. Double tap the home button while the music is playing. You will see appear a popup with the play/pause/next/previous buttons and a volume control. Do you know if it's pos...

Xcode Subproject Debug stepping

In my XCode project I link to a couple subprojects (I added those project files, added the lib file to the build phase, included its dir for the header search path). I am trying to debug my app and I'd like to step into a function into one of the subprojects, but Xcode doesn't let me. Do I need to do some other step to get this to work...

How to truncate the string into required length in iphone sdk?

Hi guys, I am having a string which contains more the 25 characters; NSString *str = @"This is the string to be truncated to 15 characters only"; In the above string I need only the 15 characters to be stored in another variable after truncation. can anyone suggest me how to do this? Anyone's help will be much appreciated. Thank yo...

Search within HTML files

Hi Forum, In my iPhone project,I have number of HTML files having different textual and image contents within each file. I need to implement search facility which would return results (HTML file names) having matched keyword. Can anybody have any clue, how can I achieve this? Thanks ...

How to make a line of code execute only after the time interval of the animation block?

I have put a line of code inside the UIAnimation block. And the next line comes after the animation block. I want the second line only to be executed after the time interval of the first animation block. Eg:- [UIView beginAnimations:@"View Flip" context:nil]; [UIView setAnimationDuration:0.5]; //First line comes here [self.view addSub...

Objective-c for the iphone: Mystery memory leak

My application seems to have 4 memory leaks (on the device, running instruments). The memory leaks seems to come from this code: NSURL *url = [self getUrl:destination]; [destination release]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setHTTPMethod:@"GET"]; [request addValue:@"application/j...

How to calculate a point with an given center, angle and radius?

In this SO question, someone asked for calculating an angle from three points. I need to do the opposite thing. I want to draw a clock, and I have tiny tick images. An art dude made 60 of them, each with an individual and accurate shadow. So there are 60 distinct images at 10x10 points in size, already correctly rotated in the center of...

UITableView - Color a selectede cell in table (remain colored)

Hi In my app i'm using a UITableViewController ("grouped style") which in one of its section I want the user to be able to see what he had selected by making this cell colored and other "uncolored". Doing it by updating all cells' background color and reloading table data, each time user touches a cell (in didSelectRowAtIndexPath:) Pr...

How they heck did they do this? Custom number pad.

http://itunes.apple.com/us/app/bistromath/id309214622?mt=8 Number pad in second screenshot: So is this some customization of the stock keypad? Modal view? ...

Hi, I wanna know how to release game UIView and go back to the root menu

Hi , for example , when you playing game , you are play in the game UIView and when you exit your game and return to the game root menu, there're a 'exit' button on the game UIView I wanna click this button to release self view and go back to the main menu how to do this? ...

Are there any useful naming conventions for *your* constant/static variable in Cocoa?

I know that constants start with the k prefix, but does anyone have their own constant prefix, so they can easily get completion on their constants, instead of Apple's? I use a three letter prefix for my classes because of my company name, let's pretend it's OMG. I tried prefixing my constants with omgkConstantName but that isn't very s...

How can I get the telnet result using C / Objective C?

Here is a telnet site: telnet://202.85.101.136:8604/ It is from Hong Kong public library, can I write some programme to get the string / result from the telnet service, and send the request from C / Objective C? thz u. ...

Finding out where I am in uinavigationcontroller hierarchy, or if view has been pushed?

I've got a view that sometimes appears as a pushed view of uinavigationcontroller, and sometime just as the initial view of a tab-bar item. There's a 'Save' button on the interface which I want to make the view pop back to previous view when it's been pushed onto screen, and do nothing when it's being displayed as part of a tab bar sele...

sqlite3 crashes for second insert statement

My App is crashing on statement (sqlite3_step(insertAlert) == SQLITE_DONE) when executed for i = 1. Can anybody tell me why it is crashing? sqlite3_stmt *insertAlert; textmeAppDelegate *textme = (textmeAppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *insert = @"INSERT INTO alerts (alert_id, email_address, messege...

Unclear why if statement doesn't work

Can somebody explain why this doesn't work: int nrSegments=[segment valueForKeyPath:@"iteneryLegs.@count"]; if (0==nrSegments) { [self removeSegment:segment]; } but this does? int nrSegments=[[segment valueForKeyPath:@"iteneryLegs] count]; if (0==nrSegments) { [self removeSegment:segment]; } ...

Does it make a difference in performance if I use self.fooBar instead of fooBar?

Note: I know exactly what a property is. This question is about performance. Using self.fooBar for READ access seems a waste of time for me. Unnecessary Objective-C messaging is going on. The getters typically simply pass along the ivar, so as long as it's pretty sure there will be no reasonable getter method written, I think it's perfe...