objective-c

What is the program flow in case navigation based application developed for iphone in objective C?

I want to know the sequence in which default or predefined methods ( such as viewDidLoad applicationDidFinishLaunching etc) are called in program execution in a navigation based application. ...

Objective C - Iphone. How can I show the numeric keyboard by default?

Hello, I'm trying the following with no luck. When the user click on a UiTextfield i need to change the keyboard view to the numeric view automatically, is this possible? Thanks in advance. ...

How to convert an NSString to char

I am trying to convert an NSString to a ResType, as defined below in MacTypes.h. FourCharCode // A 32-bit value made by packing four 1 byte characters together typedef FourCharCode ResType; I think I could use [aString getCharacters:range:], but is there a more straight forward way to make this conversion? After trying suggestions fr...

iPhone: How to send httprequest via button?

There is 1 button on a view screen, when the user clicks the button a httprequest is sent to http://domain.com/buttoninput.php?id=1 Thats it! Nothing is loaded on the screen! the page is only loaded in the background. ...

How to change this so that it returns arrays

The following code works perfectly and shows the correct output: - (void)viewDidLoad { [super viewDidLoad]; [self expand_combinations:@"abcd" arg2:@"" arg3:3]; } -(void) expand_combinations: (NSString *) remaining_string arg2:(NSString *)s arg3:(int) remain_depth { if(remain_depth==0) { printf("%s\n",[s UTF8Stri...

Getting memory leak when uploading data to the server.

Hi guys, I am uploading the data to the server it was showing leak at: NSMutableData *postBody = [NSMutableData data]; if([aCustObj.messageTitle length]>0) { printf("\n messageTitle.......%s",[aCustObj.messageTitle UTF8String]); [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n",boundary] dataUsingEncoding:NSUTF8Stri...

Strange NSNotificationCenter crash

Hey Guys, I've another problem. This time with NSNotificationCenter. Now it crashes, but a few days ago, when I added the Notification, it worked properly. In the time between I added some code that has nothing to do with that... I have about 10x10 tiles. Each tile adds itself as an observer as soon as it is created: [[NSNotificationC...

NSScanner not importing data

I'm trying to load a default set of data from a csv file into my core data db. So initially i'm trying to read in a csv file and output it to the log before trying to add it to the core data database. This is the code i'm using; //Find import file; NSString *defaultCSVPath = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"csv"...

popViewController not working when called from UIActionSheet

I encountered a strange problem when trying to go back to the previous view using an UIActionSheet. This is my code (stripped down to show the relevant part): - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { /* Doing some stuff here */ [self.navigati...

Understanding the Inheritance hierarchy in OOP

When Looking at the inheritance hierarchy trees in OOP when two objects are side by side in the diagram what is their relationship to each other? For example: NSWindow and NSView both inherit from NSResponder, so are they siblings? How do their respective methods relate? ...

How to set the thumbnail image got from MpMoviePlayerController as a thumbnail when loading the video url string into webview?

Hi Guys, I got the thumbnail Image by passing the video url to the MPMoviePlayerController and I am playing the video by loading the Url string into the webview How can I set the Thumbnailimage as a thumnailwhen playing the video in webview at present I am getting white screen with play button. My code is: MPMoviePlayerController *...

is it possible to use more than one SQLite files in CoreData?

Hello fellow stackoverflow family members? I know it is un-efficient to create one extra sqlite table in iPhone CoreData system. (X) Currently, My app has one sqlite table but there are preset data to users to no need to waste parse time. But if I adding new entity in current structure of SQLite table, it wipes up the whole preset data...

Why does this sometimes crash

Inside the function - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { I create an NSString, then give cell.textLabel.text the value of this string. Then I release it. The program will crash on getting one of the fields at the end. If I don't release the NSString, then the progr...

Is there a way to automagically get the ID that the object was allocated in?

Say I do this: @implementation currentViewController ... SomeClass *myObject = [SomeClass alloc]; How can myObject get a reference of currentViewController without sending a message to myObject like this: [myObject wasCreatedIn:self]; Side note: Where do action sheets and notifications get displayed in? The current view or the appD...

Iphone: Is this a bad Idea? Memory Management/Leak Issue

I have a class, that basically manages core data. inserts deletes and updates data. I initialize this class like so - (id)init { self = [super init]; if (self) { self.itemList = [NSDictionary dictionaryWithObjectsAndKeys: // <== LEAKS ITEMURL1, KEY1, ITEMURL2, KEY2, ...

Objective C dynamic array creation

I have an entity which stores generic information about an event. In the entity, the date the event took place is stored. My view hierarchy is such that I want the user to be able to select a year, which loads another view requesting the month in the selected year. This finally opens a view with a record of all the events that took plac...

CHCSVParser in the main thread

Hello all, This is a follow-up to a previous post regarding the CHCSVParser from Dave DeLong. In short, I am using the CHCSVParser to work with an extremely large CSV file and parse the lines into Core Data entities (on an iPhone). I've got the parser hooked up and working, and am now trying to display a progress indicator to the user...

What should I do with the no-arguments init method if there are not default values?

If I implement a class that has no sensible default values, what should I do with the init method which takes no arguments? If there are no valid defaults, the init method has no use. My gut says that it should release the object and return nil: - (id)init { [self release]; return nil; } ...but when reading the Apple docs for...

Need some direction in building an iPhone app

I have a question for you about iPhone programming. I am building an app where I show the closest specialty restaurants to the user. I am using a navigation based application to do the development. I want to let the user press a button on the first screen that allows him/her to go to screen 2. From screen 2, here the user will see ...

number of lines in UILabel

I need to get the number of lines in a UILabel, so that I can move another UILabel to be at the bottom of the last line of text. I have done: int lines = [cellDetailTextLabel.text sizeWithFont:cellDetailTextLabel.font constrainedToSize:cellDetailTextLabel.frame.size lineBreakMode:UILineBreakModeWordWrap].height /16; but well it's not ...