NSString get file as string by removing path [closed] - objective-c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
If i have a string like /Users/me/Documents/code/maccode/myApp/Icon.png
what should I do to be left only with "Icon.png"?
Using xcode and programming a mac application with objective c.
Thanks in advance.

NSString *filename = #"/Users/me/Documents/code/maccode/myApp/Icon.png";
NSString *path = [filename lastPathComponent];
That will give you Icon.png

Related

MapView snippet objective c dot notation vs message passing notation? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I saw quite a few examples with maps around the net with
MapView.showsUserLocation=TRUE;
What would be the corresponding equivalent with message passing notation?
That depends on the property declaration. In the standard case when no custom setter is declared it is:
[mapView setShowsUserLocation:TRUE];
Note that you probably want YES instead of TRUE.

NSColorWeel in objective-c.... how does it works? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
That's the problem: I have to take an NSColor from the colorweel... how could I do? I tried declaring
NSColorWeel *weel;
But I don't know what to do next!
You could go read the docs?
Looks like you just call
- (NSColor *)color
to get the current color of the well, and
- (void)activate:(BOOL)exclusive
to activate it.

writeToURL objective-C not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
writeToURL
NSString *url=#"http://192.168.1.100:88/outs.cgi?out=0";
bool okay = [url writeToURL:url atomically:NO encoding:NSUTF8StringEncoding
error:NULL];
if (!okay)
{
NSLog(#"Error writing to URL.");
}
ObjectiveC does not work. I have a link to the electronic module to the LAN that is attached cord functions. Example: 192.168.1.100:88 / st0.xml and feedback are: visible content in the browser: 11111upupupup291157-890-890-000000-600-600-600-600-600-600 345325435643254364245624562465.
I'm interested in how to send a through writeToUrl and how to save it to a string that comes in response.
Please help. This method back to me"Error writing to URL."
From NSString writeToURL:atomically:encoding:error: documentation :
Only file URLs are supported.
You can not use network URL.

How to change object in NSArray [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have two NSArrays and I would like to change one object in the first NSArray with another object in the second NSArray.
This is what I tried to do, but with no luck:
[[arrrndwords objectsinindex:i] replace object in index:1 with:[arrword indexinobject:rndnum]];
It throws me out of the app when I run it.
The method you are looking for is:
- (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withObjects:(NSArray *)objects
but it is not available to NSArray because it's immutable, you should use a NSMutableArray.
[array replaceObjectsAtIndex:[NSIndexSet indexSetWithIndex:1] withObjects:[NSArray arrayWithObject:yourObject]]

How to add an NSMutableArray into NSMutableDictionary as a key? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have an array storing some attributes (those attributes are: tableID(string), tables coordinate(x,y coordinate in float)). Does anyone know how to store this array into NSMutableDictionary? And I need this NSMutableDictionary transfer into JSON string.
You can Simply set ur MUtable Array in MUtable Dictionary like
NSMutableDictionary *muteDict = [[NSMutableDictionary alloc] init];
[muteDict setObject:mutableArrayObject forKey:#"YourKey"];