objective-c

Program iPhone Applications in Windows?

Is it possible? From what I have heard it is. I wouldn't mind just programming them in raw Objective-C. If someone could give a link to the UIKit frameworks and stuff. My iPod touch is jailbroken and I could use its frameworks, but then I couldn't utilize 3G, Camera, Phone. Please help! ...

Choosing definite ViewController from opened View stacks

Hi, I have 5 UIs/Views and these are if in normal way,one after another..1->2->3->4->5..But when i reach page 5, I would like to reopen page 3 back.I know i can use PushViewController but this one is as creating one more view and I don't want to do like that.As my views are already in view stack i m wondering anything like i can choose t...

Is it possible to use format strings to align NSStrings like numbers can be?

I'm using NSLog() to print some tabular data consisting of an NSString and an associated integer. Assume I know the length of the longest word. Is there a way using format strings to get this kind of column alignment: word:tree rank:5 word:frog rank:3 word:house rank:2 word:peppercorn rank:2 word:swor...

How to check if a string only contains alphanumeric characters in objective C?

I'm working on a small iphone project and i would need to check if the userName entered only contains alphanumerical characters? (A-Z, a-z, 0-9). How would i go about checking it? ...

SQLite record not correct on iPhone simulator

I have an SQLite db with 19 records in it. Of those records 18 have a "threatLevel" value of 1, and one of them has a "threatLevel" of 2. The field is set to default to 1. I recently changed the 19th record to "threatLevel" 2 for testing purposes. I used SQLite Manager (a Firefox extension) to add the value directly to the sqlite file...

How to hide and show the label inside a table?

I have 3 tables called radio, song, and artist controlled by favorite. Now I want to display different text for each table when there is nothing inside the table. But I want the text to be removed when there is something inside the table. I could display the text, by adding label into it. if ([mainDataCenter.favoriteArtistArray count] =...

TextFields not loading in subclass of NSWindowController

I am working on a second preferences style panel (but preferences related to a specific document.) My myDocument file is getting a little large so I decided to try using a separate subclass WindowController for the implementation. I have subclassed NSWindowController. The nib file has myController as the owner. It implements both window...

Obj-C method not being recognized in same class

I have a class that has a method: -(NSInteger) getCityCountForState:(NSString *)state CityArray:(NSMutableArray *)cityArray { NSInteger count = 0; City *city = [[City alloc] init]; for(city in cityArray) { if (city.state == state) { count++; } } return count; } That method is called from elsewhere in the same class: count = [g...

Why is "delegate" needed ? when to use it and how to apply it?

I am new to objective C. I want to ask why "delegate" is needed in objective C. Could you provide me specific reasons, situations and code examples for this. I appreciate if anyone could help. ...

Application hanging in __semwait_signal ()

I have a user of my application that sometimes when they run the application it gets stuck at the following point ... 0x92542782 in __semwait_signal () (gdb) where #0 0x92542782 in __semwait_signal () #1 0x9254243e in _pthread_cond_wait () #2 0x925440d8 in pthread_cond_wait$UNIX2003 () #3 0x95232670 in fe_fragment_render_quad () #4 ...

How to check a character array is null in objective C

How to check a character array is null in objective C? char hName[255]; - (void)setHost { phent = gethostbyaddr((const char*)&haddr, sizeof(int), AF_INET); if(phent){ strncpy(hName,phent->h_name,255); } -(void) getHost { NSString *str = [[NSString alloc] initWithBytes:tTemp.h...

How to set focus on textarea of html using objective c/ iPhone

Hi, I am using this code to set the focus on textarea of HTML control using javascript in objective c. But its not working in UIWEBVIEW, while other code working for getting values of the html controls with same controls ID. here the code: it is working NSLog(@"m values %@",[webView stringByEvaluatingJavaScriptFromString:@"document.get...

Best idea for importing text to each NavigationController View

Hi everyone i want build a poem application so i want use to NavigationControlle for show each poem ! i mean i have a TableView and on there + 50 poems ! each cell have different poem ! so what can i do to import each text or HTML Files(My Pomes) to special view , that work with navigation controller ? is it good idea to use NSArray to ...

Trouble with initializing NSMutableArray in my Singleton

Hey guys. I'm getting a weird error, and I can't figure it out. This takes place inside of a class that is created with the singleton pattern: - (NSMutableArray *) getCurrentClasses { NSMutableArray *current_classes = [[NSMutableArray init] alloc]; NSLog([NSString stringWithFormat:@"%d", [current_classes count]]); ... } ...

Cocoa-Touch How to: MPMoviePlayerController loop?

I have an app with a splash screen. For the splashscreen I've decided to add a m4v movie. I'm using the MPMoviePlayerController to show the movie. Everything is working as expected except for one thing: I'm trying to make the MPMoviePlayerController loop by subscribing to it's MPMoviePlayerPlaybackDidFinishNotification notification and ...

Tilde-based Paths in Objective-C

In Objective-C, how do I go about converting tilde-based pathnames to full pathnames? That is, I'd like to convert from ~/sandbox to /Users/TheBobs/sandbox. ...

UITableView, how do I know what Section during cellForRowAtIndexPath?

I have a UITableView displaying a list of Cities. I want to separate them by State. I can't seem to figure out how to get it to pick the right items out of my Array. If Section 1 (Arizona) has 2 Cities and Section 2 (California) has 2 Cities, during cellForRowAtIndexPath, Section 2, City 1 has an index of 0, even though it's the 3rd ite...

UIPageControl render quirk with UIScrollView

I'm building an iPhone application and like most I am trying to implement a UIScrollView with a UIPageControl, however I am coming across a very quirky behavior, which I assume may be a bug. Hopefully one of you has seen this before because it is driving me nuts. Basically, the page control works fine, everything is hooked up and works ...

Objective-C - simple setting property example erroring with 'request for ___ in something not a structure or union'

Hi all, I've been banging my head with this one this evening and am sure it's something very simple that I've missed I've created a new project with the appdelegate and a view controller class as below. The view controller synthesises the property in the .m, and the app delegate header imports the view controller .h file. Code below: V...

NSMutableArray addObject, unrecognized selector

I'm trying to create an array (States) of arrays (Cities). Whenever I try to add an item to my City array I get this error: 'NSInvalidArgumentException', reason: '*** +[NSMutableArray addObject:]: unrecognized selector sent to class 0x303097a0 My code is as follows. The line it errors on is [currentCities addObject:city]; I'm sur...