objective-c

Error while checking if a file exists

Hi, I'm trying to write to a plist file using writeToFile, before I write I check whether the file exists. This is the code: #import "WindowController.h" @implementation WindowController @synthesize contacts; NSString *filePath; NSFileManager *fileManager; - (IBAction)addContactAction:(id)sender { NSDictionary *dict =[NSDicti...

Loading Nib and Displaying Window in Objective C++

I am trying to load a Nib from a C++ constructor with Objective C++. I have searched and found enough examples to get some code together but it doesn't display the window. Or any windows for that matter. Here is an example of the contructor: JokeSystem::JokeSystem() : fileSystem("/Library/Application Support/Jokes/") { try { ...

Detect if line segment intersects square

Anyone have a simple algorithm for this? No need for rotation or anything. Just finding if a line segment made from two points intersects a square ...

stringWithContentsOfURL leaking memory

Would it shed more light if I told that fetchHTML was being called in a seperate thread? I am also seeing several messages in the debug console such as: _NSAutoreleaseNoPool(): Object 0xd92860 of class NSCFDictionary autoreleased with no pool in place - just leaking _NSAutoreleaseNoPool(): Object 0xd92800 of class NSCFString autoreleas...

selectedSegmentIndex makes my app crash

Hi all! I have a UISegmentedControl and whenever I touch a button it should show an alert with the index of the segment currently selected: - (IBAction)bOkayTouched:(id)sender { NSString *msg = [NSString stringWithFormat:@"%@", [scRPSSL selectedSegmentIndex]]; UIAlertView *lol = [[UIAlertView alloc] initWithTitle:@"Mkay" messag...

UITableViewCell subclassing optimization

If i do a custom cell, is it best practice to... put icons and labels all on one view and drop it to the contentView (assuming you want everything to shift in edit mode) or put all editable stuff (labels) on one view, and non editable (icons) on another view and drop them to the contentView or it doesn't matter because when the label t...

How can i take an UIImage and give it a black border?

How can i take an UIImage and give it a black border? (iphone) tnx ...

Free UML diagram tool for Objective C

Hi, Are there any free tools in the market which support Objective C? ...

How to do sparse array in Cocoa

I have an undetermined size for a dataset based on unique integer keys. I would like to use an NSMutableArray for fast lookup since all my keys are integer based. I want to do this. NSMutableArray* data = [NSMutableArray array]; // just create with 0 size then later people will start throwing data at me with integer indexes (all un...

Can a C function be used as a selector in Cocoa?

I want to start a new thread using a C function, not an objective-C method. I tried [NSThread detachNewThreadSelector: @selector(func) toTarget: nil withObject: id(data)]; where I have void func(void *data) { // ... } and data is a void *, but I get a runtime crash in objc_msgSend, called from -[NSThread initWithTarget:selector...

What are good database options to use for app dev on Mac OSX?

I'm looking to develop a small application on Mac OSX and it will need to use a database. Can anyone recommend one for the Mac? This will be my first Mac development so this is very much a newbie question. To help you I am interested in the following aspects: Is it suitable for small applications? (Important) Is it suitable for larger...

Scrolling view like app details screen

I am trying to figure out the best way to create a view like the app details screen in the AppStore app. I want a thumbnail and text content under it that all scrolls if the content is too long. Is this done in a tableview or a scrollview? ...

How do I control the position of an image in a grouped tableview cell?

For some reason, I can not seem to change the default position of an image in a grouped tableview cell. In the cellForRowAtIndexPath method I use the following to load the image: cell.imageView.image = [UIImage imageWithContentsOfFile:MainImagePath]; I've been experimenting with the following to adjust the position of the image but h...

Count of chars in NSString or NSMutableString?

I've tried this NSCharacterSet *myCharSet = [NSCharacterSet characterSetWithCharactersInString: myString]; [myCharSet count]; But get a warning that NSCharacterSet may not respond to count. This is for desktop apps and not iPhone, which I think the above code works with. ...

what API should i use to lock and unlock screen in MAC OS X ?

Can you tell me what API and function should i try to use to make an application that will lock and unlock screen using the dialog box in MAC OS X? ...

Take the photo without the imagepicker

HI Guys! I'm working on a camera application. I want to use a timer to take a photo (without user interaction). But apple provides only UIImagePicker to take snapshots and create videos. is there any other way to do this. or there is a way to take a image automatically through ImagePicker without pressing the take picture button. Thanks...

Show/Hide TabBarController in iphone

hi, i am making an application in iphone in which i have 4 tabbars & in one of its tab i have 4 views in 2nd view it needs to hide the tab bar. I am able to hide the tab bar using the setHidesBottomBarWhenPushed:YES in in the initWithNib method of the Viewcontroller being pushed. But when navigating to the screen 3 , calling the same met...

Sharing NSOperationQueue across View Controllers?

I'm using an NSOperationQueue to manage HTTP connections (using ASI-HTTPRequest). Since I have multiple views and the need to have these different views requesting HTTP connections, should I try to create a global NSOperationQueue in the app delegate, or should I have one in each of the views? I'm not familiar with NSOperationQueue. I'd...

remove every type of subview from uiscrollview?

hello all i am using this code to show flip animation...... i have a uiview with scrollview(paging enabled)...so it shows a view like a page...now i also have done flip animation using this code.... -(void)flipView { flashCardAnswerController *flashCardAnswerControllerobj = [[flashCardAnswerController alloc] initWithNibName:@"Flash...

keeping the selection "permanent" in the UITableView cell

Hello all , I seem to be having a problem in my UITableView clicking behaviour. I'm using a Tree to create a hiearchy of tableviews. My problem arises when I enter the following screen ( I produced some screenshots to clarify ). 1) When I enter this screen http://img129.imageshack.us/img129/4050/samplec.png I can go to my next...