Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > simple NSPoint adn NSString question

simple NSPoint adn NSString question
Thread Tools
Junior Member
Join Date: Nov 2000
Status: Offline
Reply With Quote
Mar 10, 2001, 10:37 PM
 
ok, i guess these are two newbie questions.

For NSPoint - how do you code one? Where is the method to produce them?

for NSString, if a method takes an NSString argument, can you enter a literal "test" instead of a reference to an object?

-Max
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Mar 11, 2001, 04:59 AM
 

In ObjC, NSPoint is a simple C structure.

NSPoint aPoint;

aPoint.x = 4.0;
aPoint.y = 5.0;

or

NSPoint aPoint = {4.0, 5.0};

or

aPoint = NSMakePoint(6.0, 5.0);


As for NSString, "test" is a literal c-string, and @"test" (adding the @ character in front) is a literal NSString.

     
Junior Member
Join Date: Mar 2001
Status: Offline
Reply With Quote
Mar 16, 2001, 12:47 AM
 
NSPoint is indeed just a standard C structure. However, you should use the supplied functions to create and manipulate points where possible. The NSPoint functions are discussed in (brace yourself)

/System/Library/Frameworks/Foundation.framework/Versions/C/Resources/English.lproj/Documentation/Reference/ObjC_classic/Functions/FoundationFunctions.html

-Peter
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:53 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2