I'm trying to allow users to simply hit Enter without typing anything, and use this to mean accepting a default value. scanf isn't doing what I want and the app still 'blocks': the next line of code doesn't run.
The only way is to actually type something THEN press Enter.
I tried using NSFileHandle and fileHandleWithStandardInput; how...
Hi,
I'm trying to work out a way to identify the executable path of a command line tool in Objective C.
Hence, if the executable is /Applications/Utils/MyTool, then that method would return /Applications/Utils
I'm using the Foundation framework.
Any help would be great, thanks
...
I have a core data iPhone application.
I have two views on a navigation controller (view A = root, view B = child).
I would like to tell view A to update it's tableView when view B is popped off the navigation controller (i.e. when the user presses the 'back' button). What method is called when this occurs? Do I need to setup some sort...
my protocol:
@protocol ElectricalSystemEngineDelegate
-(void)didRequestMainMenu:(id)sender;
@end
I designed this protocol in order to handle dismissal of a modal View Controller inside my rootView controller. My rootView controller adopts this protocol and is declared as follows:
#import "ElectricalSystemEngineDelegate.h"
@interface...
Hi,
My code:
stringFromRecievedData =
[[NSString alloc]initWithData:_data1 encoding:NSUTF8StringEncoding];
if (![stringFromRecievedData isEqualToString:lastStringFromRecievedData]) {
[lastStringFromRecievedData setString: stringFromRecievedData];
I get the same "not equal" result even in the second round- even when it is the...
I have an application which runs on a UINavigationController. Now I would like to add a UIToolbar element to the bottom of each screen. The Toolbar on the bottom should the be customizable for the ViewController that is currently being displayed. My first idea was to simply add the toolbar to the navigationController view and tag it, in ...
Is it possible, to change the title of my application at runtime, which is displayed in the dock?
...
Hello,
I have a multithreaded application that has many concurrent operations going on at once. When each thread is finished it calls one of two methods on the main thread
performSelectorOnMainThread:@selector(operationDidFinish:)
// and
performSelectorOnMainThread:@selector(operationDidFail:withMessage:)
When an operation fails, I l...
Whats the best way to get the current time (HH:MM:SS) using Objective-C. I would guess I should be looking at NSDate & NSDateFormatter. I had a quick glance at the docs and it looked a little more convoluted than I expected, so I thought I would check here to make sure I was on the right track.
gary
...
I have a 1600x1600 1.2MB image which resized to 320x320 shrinks to 404KB.
I need to go further and reduce the bytes size without reducing the image aspect size.
Currently i'm using the -TIFFRepresentationUsingCompression:factor: NSImage method with NSTIFFCompressionJPEG and factor that doesn't seem to influence the image size/quality.
...
Hi,
I am working on an iPhone app, and would like to be able to click on a link that is in UITableView. When the Link, and only the link is selected I want the Safari app to be opened to the selected link. Any suggestions on how to do this? Thanks so much!
...
I have an NSDocument-based Cocoa app and I have a couple of secondary threads that I need to terminate gracefully (wait for them to run through the current loop) when the users closes the document window or when the application quits. I'm using canCloseDocumentWithDelegate to send a flag to the threads when the document is closing and th...
I need to write code to determine if 2 strings match when one of the strings may contain a small deviation from the second string e.g. "South Africa" v "South-Africa" or "England" v "Enlgand". At the moment, I am considering the following approach
Determine the percentage of characters in string 1 that match those in string 2
Determine...
Hi.
I have a MPMoviePlayer setup to play an intro movie to my application. That works just great, the only problem is that it lasts for 14 seconds, and I want to give my users a chance to skip the intro by pressing anywhere on the movie.
I have hidden the movie controls, as they are not needed.
Code:
NSString *introPath = [[NSBundle ...
I try to remove a view from it's superview after being animated offscreen. But it seems when I add the removeFromSuperview call after when the animation is supposed to end, the view would no animate at all but instead disappear instantly from the screen.
So why is there no animation when I add the [[self pickerView] removeFromSuperview];...
I'm working with sockets and trying to simply write a string to the socket. I found a couple of examples on how to do this, such as the following example (oStream is an NSOutputStream). This is all within the NSStreamEventHasSpaceAvailable.
uint8_t buffer[11] = "I send this";
int len;
len = [oStream write:buffer maxLength:s...
In Objective-C, I have a simple block of code that increments a counter each time a button is pushed. My logs, and even updates to the interface, are showing an increment of 4 instead of one. Is this just a display issue with my formatting (I'm using %d) or something else I'm missing? My guess lies with the "%d" but I'm new to Objective-...
I'm making an app that includes the same group of buttons in many different contexts. The buttons send their actions to a different object in each context. I'd like to be able to design a single NSView in IB containing the buttons, and then be able to put copies of that view in many places in my nibs, while maintaining the link, so chang...
Alright, so I've been doing some poking around, and I realize my problem, but I don't know how to fix it. I have made a custom class to hold some data. I make objects for this class, and I need to them to last between sessions. Before I was putting all my information in NSUserDefaults, but this isn't working.
-[NSUserDefaults setObje...
I want to draw a triangle and elide text in the shape. I can restrict the triangle to an equilateral triangle and a fixed orientation ('upside down' or 'upside up'). Then I want to insert arbitrary text in the triangle such that the eliding is on word boundaries and not clipped.
Any simple algorithms? What methods are available in Ob...