objective-c

Maintain Undo In Modified, Bound, NSAttributedString

I've got an attributed string bound to a NSTextView. I'm using a method that is called (using KVO) every time the string is edited to add background color attributes to string based on a regEx match. I do this by creating a new mutable attributed string with -initWithAttributedString: then -beginEditing, -addAttribute:, -endEditing. Once...

Standard (32/64-bit Universal), WebKit, Flash Plugin and Leopard

I have an Xcode project which builds a Cocoa desktop Browser application. My Browser links to the standard WebKit.framework on the system (it does not embed its own WebKit.framework). The "Base SDK" for my Xcode project is set to "Mac OS X 10.5". The "Valid Architectures" for my Xcode project is set to "i386 ppc ppc64 ppc7400 ppc970 ...

WEB color to CIColor

How can i set CIColor from HTML color format? For example i read from file "#e0e0e0" and i need set this color to UILable. when i try use [UIColor colorWithRed: green: blue: alpha:1.0] i found that it's use float number that define color in %. How can i use LONG color format that set backgroundColor to UILable? ...

Does stringWithContentsOfURL use the system proxy settings?

I am using the following code to fetch the contents of a web page but it needs to follow all the network rules etc as defined in the user's system prefs NSURL *url = [NSURL URLWithString:@"http://thetalkingcloud.com/static/ping_desktop_app.php?v=1.0"]; NSError *theNetworkError; NSString *content = [NSString stringWithContentsOfURL:ur...

Unnecessary temporary variables when setting property values?

I'm following a book on iPhone development and there is a particular pattern I keep seeing in the example code that doesn't make much sense to me. Whenever a property is set they first assign a pointer to the new value for the property, then set the property to the pointer, then release the pointer. Example: Interface: @interface Doubl...

Long Double on the iPhone

hi, im working on an application that requires me to use a Long Double variable, which, in C/C++/ObjC, should be precise up to 15 floating values (1.123456789012345), the only issue is that on the iphone, i can only seem to display up to 6 places (1.123456) using NSString *display = [NSString stringWithFormat:@"%Lf",value]; I was read...

Maximum index size for array

Hello, The following code is crashing my program. I found the problem is the size of the array. If I reduce the size to 320*320, it works fine. Does it make sense that this wound be a limitation? If so, what is a work around? I am coding in Objective C for IPhone. Any help would be appreciated. Thanks! int life_matrix[320*350];...

how push notification works and what is the requirements of it?

i want to know how do i enable my application to use push notification service.i read the guide but doesn't find it much detailed information about it.Could someone tell me an easy way that how it works,what are the requirements,how do i apply this in my app. one thing i would like to know that according to guide the connection between p...

getting error when using mapkit in xcode?

'NSInvalidUnarchiveOperationException', reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (MKMapView)' i am getting this error.am i missed something.i don't know from where to add MApkit.framework first i tried with target->getInfo and then from the bottom + sign added framework but that did not wrked....

picker view shows numbers in pickerview but not showing properly on label?

i have added a pickerview from interface builder.i am using this method to show data like this.... - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { if (pickerView == SpotPickerView) // don't show selection for the custom picker { // report the selection to the UI label l...

Cocoa/Objective-c 'system();' acting weird

I'm trying to run an applescript inside my Cocoa app using the system(); function - the string I'm passing to the function works in terminal and the applescript itself is fine, I think it has something to do with NSString - can anyone help? //add to login items NSLog(@"add to login"); NSString *pathOfApp = [[NSBundle mainBundle] b...

Dispatch queues: How to tell if they're running and how to stop them.

I'm just playing around with GCD and I've written a toy CoinFlipper app. Here's the method that flips the coins: - (void)flipCoins:(NSUInteger)nFlips{ // Create the queues for work dispatch_queue_t mainQueue = dispatch_get_main_queue(); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, NUL...

Objective-c way of serializing arrays that contain different types

Hello, My NSMutableArray instance contains instances of different types of objects that have common ancestor. I want to serialize the array, but NSKeyedArchiver class seems to archive arrays contain certain types of objects. Is there an easy way to to this with stock serialization classes ? ...

How do I manage the drawing of custom data (not photos) in an NSView that has an area dynamically larger than what is viewable?

UPDATE: Relative to the questions and answers below, it seems I have a misunderstanding of the NSView class in relation to the custom classes I'm trying to draw and the wrapping NSScrollView. In the end, what I'm trying to figure out is how do I manage the dynamic drawing of custom data (not photos) in an NSView that has an area larger t...

Cocoa-Touch, Core Data: Linker error, NSManagedObject symbol not found

I have a cocoa-touch app, using the core data framework. I've created a xcdatamodel with two entities: Program and ProgramReplay. ProgramReplay has a relationship to Program, and a reverse relationship exists in the later. I've saved this, and used XCode's feature to generate the classes for these two entities. The generated headers ar...

Streaming Audio FROM iPhone to Browser. Ideas?

I have seen plenty of articles and SO questions about streaming TO an iPhone app, but my question is the reverse, that is, streaming FROM an iPhone app. I have audio content in an iPhone app, that I want to stream to a browser. So the idea is that the browser can connect to a server running on the iphone. The server on the iphone will...

Creating NSMatrix of NSImageCells

I need to create an NSMatrix with NSImageCells bound to an array controller. So the content of the NSMatrix is bound to an NSArray (so there are as many NSImageCells in the matrix as there are objects in the array), then the image path of the NSImageCells are bound to a key called "iconPath" in the Array Controller. And then when an ima...

UIView subclass draws background despite completely empty drawRect: - why?

So, I have a custom UIView subclass which enables drawing of rounded edges. The thing draws perfectly, however the background always fills the whole bounds, despite clipping to a path first. The border also draws above the rectangular background, despite the fact that I draw the border in drawRect: before the background. So I removed the...

UIButton like in UIActionSheet

I would like put UIButton on my UIViewController with style like have buttons in UIActionSheet. What should i add here: UIButton *button = [UIButton buttonWithType: UIButtonTypeCustom]; [ button setFrame: CGRectMake(10, 10, 50, 35) ]; [button setTitle:@"Button from UIActionSheet" forState: UIControlStateNormal]; [self addSubview: button...

Auto-hide the OS X menu bar system-wide

I wish to write a utility to auto-hide the menu bar, much like the dock. This would replicate the a OS X 10.4-only application "Menufela", but for Snow Leopard. [[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock]...