objective-c

Passing NSInteger variable to NSMutableDictionary or NSMutableArray

Why does this not work: NSInteger temp = 20; [userSettingsFromFile setObject:temp forKey:@"aTemp"]; but this does: [userSettingsFromFile setObject:@"someObject" forKey:@"aTemp"]; How can I use the NSInteger variable? ...

VPN in cocoa app

Is it possible to setup a vpn connection in my cocoa app or from a commandline? And where should i start if i want to do something like that? ...

How can I find out the type of a NSDictionary element?

How can I find out the type of a NSDictionary element? ...

does removefromsuperview releases the objects of scrollview?

for(UIView *subview in [scrollView subviews]) { NSLog(@"subviews Count=%d",[[scrollView subviews]count]); //[subview release]; [subview removeFromSuperview]; } in the above method if i use [subview removeFromSuperview]; it works fine...but if i use [subview release]; it crashes....i want to know that if both are same or is the...

Allocating memory for NSString?

I am new to Objective-C and I am a little curious about how I should be managing the memory for the local NSString variables shown below and the associated instance variables inside the class object. The code I have works fine, but just curious as to best practice. Edited to include full code, nothing special, like I say I am just curio...

No results in Spotlight in searches against kMDItemPath

I am trying to create a Spotlight query that searches for a string in the path of a file (I would like it to match in either the name of the file or the name of any of the folders is contained in). NSPredicate *predicateTemplate = [NSPredicate predicateWithFormat: @"kMDItemPath like[wcd] $SEARCH"; [query setPredicate: [predicateTem...

Assigning to self in Objective-C

I'm from the C++ world so the notion of assigning this makes me shudder: this = new Object; // Gah! But in Objective-C there is a similar keyword, self, for which this is perfectly acceptable: self = [super init]; // wait, what? A lot of sample Objective-C code uses the above line in init routines. My questions: 1) Why does assign...

Making an NSButton inactive.

What I want to do is as simple as hide a button. Currently I have used the code … [myButton setTransparent:TRUE] … that works BUT if you click where the button is and even though it's hidden whatever it's action is still happens. Is there a way to disable the NSButton? ...

Calling a method which is also used by UIButton?

Hi, I have a small iPhone app which I've created a button with some functionality in. My question is, how can I call this button without actually pressing it? Any help would be appreciated! Thanks ...

NSURLDownload resumedata encoding

Hi, I have been trying to figure out recently the data encoding used for the resumedata of an NSURLDownload. My situation requires me to create the resume data myself and use that to create a download. The reason for this is because the ETag is not always available from the server. While I am extremely hesitant to use the private API, I...

sleep time into for loop

Hi: I need to make a for loop and between every loop wait 2 seconds and continue for (int i = 0; i < [stories count]; i++) { //my code //sleep 2 seconds and continue } How can I do this? ...

[iPhone SDK] [Newbie] UITextView textViewDidChange will not be called?!

Hello, I have a small iPhone Project with a UITextView on my View, designed in the Interface Builder. In my Viewcontroller is an IBAction Method and I connected the UITextView to that IBAction. I also added in my controller .h the <UITextViewDelegate>. In my .m File I added the Method: - (void)textViewDidChange:(UITextView *)textView{...

Custom back button view

I'm trying to change the back button to a custom one. If I create a UIBarButtonItem with just a custom title, that works fine. However if I create one with a custom view, the button doesn't show, rather the default back button shows. Any ideas ? UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; backBtn.frame = CGRectM...

Plist Array to NSDictionary

I have a plist: <plist version="1.0"> <array> <dict> <key>name</key> <string>Alabama</string> <key>abreviation</key> <string>AL</string> <key>date</key> <string>1819</string> <key>population</key> <string>4,627,851</string> <key>capital</key> <string>Montgomery</string> ...

Trying to Access Application Delegate Variables / Properties

I am using a variable/propery of my application delegate as a global. (I don't want to deal with a singleton class.) I am trying to write a #define statement in my Application Delegate class. If I type: [UIApplication sharedApplication] in my app delegate class, code hinting does not recognize sharedApplication. But if I type th...

Difference Between Application Delegates

What is the difference between: [[UIApplication sharedApplication] delegate] and UIApplicationDelegate ...

NSImageRep confusion

I have an NSImage that came from a PDF, so it has one representation, of type NSPDFImageRep. I do an image setDataRetained:YES; to make sure that it remains a NSPDFImageRep. Later, I want to change the page, so I get the rep, and set the current page. This is fine. The problem is that when I draw the image, only the 1st page comes out. ...

Load SWF inside NSView

Is there any way to load a swf file and display it in a NSView? ...

Red Gate Profiler equivalent for Objective-C Mac / iPhone

I love the profiling tools that Red Gate makes for when I write in C#. Right now I am writing an application for iPhone in Objective-C and I am having a hard time adjusting to Instruments. It's just not as easy to use. Does anybody have a better code profiler for memory and performance? If not, any good tutorials for instruments? Th...

Data base for iphone application - any advice?

I am building an iPhone app that contains medical information for medical professionals. The data has a sort of taxonomy which is easily represented in the form of e.g. a mind map on a piece of paper. On the device, the idea is to navigate through a series of items in table views to get to a detail view with text and picture information...