I am trying to create a site-specific browser application. I've created a new Cocoa app, added a WebView to my window, and am loading up the page. The page contains a Flash movie, which can be controlled via the keyboard. I'd like to wire up some menu commands to trigger the actions, presumably by simulating the keystrokes.
I've travers...
I'm getting some leaks (obvserved by Instruments) when trying to reuse an existing NSMutableArray (in order to save memory).
Basically I'm creating an NSMutableArray, filling it with objects (UIImages) and passing it onto another object which retains it. However, I now need to use an NSMutableArray again. I figured I would release all ...
Hi all,
I need to deal with an http authentication (401) using the NSURLConnection class, so I implemented the "connection:didReceiveAuthenticationChallenge:" delegate method.
In this method, to respond to the server challenge, I need an information contained in the http server response headers (the WWW-Authenticate header one). My pr...
You can view the Java API in tree structure. So you can view all the subclasses of Object.
How would I view all the subclasses of UIView or NSObject IPhone Cocoa API?
I just found out you can do this:
self.tableView.tableHeaderView = searchBar;
searchBar is subclass of UIView. I want to add a textField to a tableView. I wonder if ...
Hi All
I want to line break using shift+enter in TextField(Control+Enter is working)
I don't want to use TextView because using this Enter Key Action is not performing..
Thanks
Deepika
...
Hi
I have a one to many relationship between two objects, lets call them Gallery and Images.
Each Image belongs to a Gallery and each Gallery has many Images.
I would like to add a fetched property to my Gallery model which would return one and only one Image object.
Is there a way to do this with fetched properties?
...
Here's the setup: I have a subclass of IKImageBrowserView whose zoomValue property is bound to a key VFBrowserZoomValue in the shared NSUserDefaultsController. I have an NSSlider whose value binding is bound to the same key.
This works perfectly to change the zoomValue of the browser from the slider.
I'm trying to implement -magnifyWi...
I want to retrieve the system language of a Macintosh in ISO-639-2 format (that is, in three character format).
Currently, I'm trying to use [NSUserdefault objectforkey:@"Applelanguages"]. This returns the Language code in 2 character format.
Whatever API I end up using, it should support MacOS X versions from 10.3.9 forward.
...
The text I use in an NSTextField is loaded from a file as follows.
NSString *path = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"];
NSAttributedString *as = [[NSAttributedString alloc] initWithPath:path documentAttributes:NULL];
[creditsLabel setAttributedStringValue:as];
[creditsLabel becomeFirstResponder];
The hyp...
The main view of my NSPersistentDocument based application is a table view (bound to an NSArrayController) showing the list of records, below it there is an "add record" button. I want the button to cause the following (supposedly trivial) behavior.
Create an new object
Set some defaults to the new object (that are stored in the main ...
I know that discussions about coding styles tend to end in disaster and endless flame wars, but that’s not what I want to reach. During the last decade I mainly saw two different coding styles for dealloc methods in Objective-C. The first and most common one was to place dealloc at the bottom of the file. This is also the style Apple use...
From an Apple example, I have this:
Event *event = (Event*)[NSEntityDescription
insertNewObjectForEntityForName:@"Event"
inManagedObjectContext:self.managedObjectContext];
Event inherits from NSManagedObject. Is there a way to avoid this weird call to NSEntityDescription and instead just alloc+init somehow directly ...
Apple provided this example:
NSError *error;
NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
if (mutableFetchResults == nil) {
// Handle the error
}
Why are they calling mutableCopy here? Is it because they wanted to have an NSMutableArray rather than an NSArray,...
I wonder if I could just execute a NSFetchRequest with just the Entity and nothing else. However, it seems to work with no errors, but since I've never seen anyone doing that, I wonder if there are any bad drawbacks in doing this. The documentation doesn't say if there's any default value used instead when I provide no NSSortDescriptor.
...
I am making a Cocoa NSDocument-based app scriptable. If I try to create a new document with the following AppleScript:
tell application "MyApp" to make new document
a new document is created, but its title is nil. Any ideas on why this would happen and how to fix it?
...
Hi have an newbie issue with objective-c, cocoa & iPhone. I've declared mapView in my application delegates applicationDidFinishLaunching:application: which is instance/pointer of MKMapView class. mapView is a member of my application delegate.
In my view controller in viewDidLoad: I get instance of my application delegate with the foll...
Hi,
I'm trying to create a column with an empty string as the identifier but Cocoa seems to replace the empty string with the word "Field" every time I try to create the column. How do you go around this?
- (void)addColumnWithCheckboxToTable:(NSTableView *)table
{
// Add column with checkbox before all other columns
// This col...
I'm new to Cocoa and I want to know how I can get a list of all open windows. I'm not talking about running programs, since this would be an easy task. I want to list windows, for example, if I have Preview running with 10 pdf opened, my program should be able to retrieve a list with all those pdf.
I also want to know if there's some AP...
Hi,
I want to create a global shortcut for my app. I've used the 'cool new way' of doing this with the addGlobalMonitorForEventsMatchingMask method. The problem is, my events don't get "consumed": my shortcut includes the spacebar, so whenever I use the shortcut, Quicklook pops up when I'm in the Finder.
How can I prevent this from hap...
Is there anyway to get int (or float) numbers into a NSString object without using alloc and a subsequent release?
int myInt = 25;
NSString *myString = [[NSString alloc] initWithFormat:@"%d",myInt];
...
[myString release];
EDIT:
Thanks for the answers, I should have been a little more clear in the question, I am particularly interes...